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

Home -> Community -> Usenet -> c.d.o.misc -> Re: to_char number format with optional decimal-point?

Re: to_char number format with optional decimal-point?

From: G Quesnel <dbaguy_ott_at_yahoo.com>
Date: 20 Jul 2006 04:51:04 -0700
Message-ID: <1153396264.182036.106240@i42g2000cwa.googlegroups.com>


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_Number
  4 from dual;

A_NUMBER



  10.01

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

Original text of this message

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