Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Retaining Trailing Zero In a Number Column?
Karsten Farrell wrote:
> dave_at_simcik.com said...
> > Hey group,
> > This is probably a common question, but searching through the docs
> > has revealed nothing. If I have a field in my table that is intended
> > to be used as a price and I'm using the Number datatype [Number(8,2)],
> > how can I keep the trailing zero on my prices (140.50 --> 140.5)?
> >
> > Any help is much appreciated.
> >
> > Regards,
> > DTS
> >
> They're really there ... you just have to tell sqlplus what format to
> display the number in:
>
> SQL> select 140.50 from dual;
>
> 140.50
> ----------
> 140.5
>
> 1 row selected.
>
> SQL> select to_char(140.50,'999.99') from dual;
>
> TO_CHAR
> -------
> 140.50
>
> 1 row selected.
>
> --
> /Karsten
> DBA > retired > DBA
Or
SQL> col <column_name> format 999,999.99 SELECT 140.500 FROM dual;
-- Daniel Morgan http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp (remove one 'x' from my email address to reply)Received on Wed Apr 23 2003 - 16:59:07 CDT