Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Leading zeros for numbers between 0 and 1
Look at the to_char function. I believe that one of the formats allows a
leading zero.
e.g. to_char(field,'0.99') which will give a leading zero and 2 decimal
places.
Jim
"Michael Mauch" <michael.mauch_at_gmx.de> wrote in message
news:p7r5t9.hm.ln_at_elmicha.333200002251-0001.dialin.t-online.de...
> Hi,
>
> is there a way to get leading zeros for numbers between 0 and 1, e.g.
> "0.12" instead of ".12"?
>
> I know I can use NLS_NUMERIC_CHARACTERS to set the characters printed
> for the decimal and thousands separators, but I can't find a way to
> automatically get these leading zeros.
>
> I wrote an flatfile export utility in Pro*C, and it was a real hassle to
> get these leading zeros:
>
> a) First I find out which columns are numeric (once for each query).
> b) Then for each field (each row, each column!) I have to check if that
> column is numeric, than check if the first character is not a digit
> (and not a minus sign) and then perhaps prepend/insert a zero.
>
> So is there a better way?
>
> Regards...
> Michael
Received on Sat Nov 17 2001 - 09:18:00 CST
![]() |
![]() |