Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: to_char number format with optional decimal-point?
I don't have the answer to your question, but if you can not find the
formating string then you could produce the desired result by adding a
case structure around your to_char formatting. Something like ...
SQL> Select (case when 10.01 > trunc(10.01)
2 then trim(trailing '0' from to_char(10.01,'990.999')) 3 else to_char(10.01,'999') end) A_Number4 from dual;
A_NUMBER
or perhaps you could wrap the formatted column in two trim statement:
- first to remove trailing '0'
Hopefully, someone else can come up with a formating string. Received on Thu Jul 20 2006 - 06:51:04 CDT