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
Frank Suijkerbuijk <fsuijkerbuijk_at_home.nl> wrote:
> one way is to use the set numformat option. If you use i.e set
> numformat 9,999,999,990.00000000, select .1 from dual will get you
>
> SQL> set numformat 9,999,999,990.00000000
Thank you for your suggestion. I'm sorry that I obviously didn't point out enough that I don't use SQL*Plus, but Pro*C, so I can only use SQL commands (or maybe some special Pro*C constructs).
> SQL> select .1 from dual;
>
> .1
> -----------------------
> 0.10000000
>
> Set back is that to much decimals will not work.
Yes, and the superfluous "0" at the end of the "0.1" is not nice, too.
> SQL> select .000000000000001 from dual;
>
> .000000000000001
> -----------------------
> 0.00000000
>
> or this will not work
> SQL> select 11000000000 from dual;
>
> 11000000000
> -----------------------
> #######################
Yeah, the #'ification of numbers seems one of the greatest "features" of these fixed width formats. Wouldn't it be better to just print the whole number and perhaps trash the formatting of columns, but at least retain the information?
> So you would need to set a very good standard.
Yes, but finding out that standard seems to be not easy. The default format "TM9" comes closest, it only lacks the leading zeros for values between -1 and 1. Given that there is even a format for Roman numbers, such a "TM0" format seems not too bloatful to me.
Regards...
Michael Received on Sun Nov 18 2001 - 11:13:57 CST
![]() |
![]() |