Thread: lpad question

lpad question

From
"Johnson, Shaunn"
Date:

Howdy:

Running PostgreSQL 7.2.1 on RedHat Linux 7.2.

I'm trying to create a view where I lpad a numeric field with leading
zeros and keep the two digits right of the decimal.  Can someone send an example? 

Thanks!

-X

Re: lpad question

From
"Johnson, Shaunn"
Date:
--howdy:
 
--okay, i *think* i'm close, but i'm not sure about what
--i'm seeing as results.
 
--i have this:
 
[snip]
 
testdb=> select lpad(to_char(i_pd,'99999D99'),10,'0') as i_pd from t_table limit 1;
 
[/snip]
 
and the results are:
 
[snip results]
 
    i_pd
------------
 0      .00
(1 row)
 
[/snip results]
 
* Why is there a gap between the lead zero and the decimals?
* Where is the docs to tell me what, exactly, this is doing?
 
Thanks!
 
-X
 
 
 
-----Original Message-----
From: Johnson, Shaunn

Howdy:

Running PostgreSQL 7.2.1 on RedHat Linux 7.2.

I'm trying to create a view where I lpad a numeric field with leading
zeros and keep the two digits right of the decimal.  Can someone send an example? 

Thanks!

-X