Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to format NUMBER(8,4) to '0000.0000' output??

Re: How to format NUMBER(8,4) to '0000.0000' output??

From: salenavr <navrsalemile_at_yahoo.ca>
Date: 6 Sep 2006 16:28:23 -0700
Message-ID: <1157585303.157913.270370@p79g2000cwp.googlegroups.com>

mRangel wrote:
> Well, nvl(to_char(COLA, '0000.0000'),' ') does the trick. Why
> do you need the LPAD ?
>
> system_at_TREINA01> create table besta ( numero number(8,4) );
>
> Table created.
>
> system_at_TREINA01> insert into besta values (1973.234);
>
> 1 row created.
>
> system_at_TREINA01> select to_char(numero,'0000.0000') from besta;
>
> TO_CHAR(NUMERO,'0000.0000')
> ---------------------------------------------------------------
> 1973.2340

Strange! But not on my machine (Oracle 9i R2) it does not work. Maybe your number is not as mine? Try to use a number with 4 decimal places AFTER decimal point.
e.g. 0.2345

Anyways, I found the solution. I simply added 'fm' to teh format description:

'fm0000.0000'

and voila, it worked!! Received on Wed Sep 06 2006 - 18:28:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US