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: decimal formatting in file output

Re: decimal formatting in file output

From: siddhana <siddhana_at_gmail.com>
Date: 21 Nov 2006 03:57:41 -0800
Message-ID: <1164110261.904280.39330@h48g2000cwc.googlegroups.com>

Michel Cadot ha scritto:

> "siddhana" <siddhana_at_gmail.com> a écrit dans le message de news: 1164026984.880988.98290_at_b28g2000cwb.googlegroups.com...

> | Hi,
> | i've oracle 8.1.7.0.0 running on a sun solaris system,
> | i'm in Italy so i suppose there is the italian configuration for
> | decimal format.
> | I need to print to file some numerical data,
> | if i run the query:
> |
> | Connesso a:
> | Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
> | With the Partitioning option
> | JServer Release 8.1.7.0.0 - Production
> |
> | SQL> SELECT rate -- number (38,12)
> | 2 FROM AL_ACTIVITY
> | 3 WHERE loan_id = 24501 ;
> |
> | RATE
> | ----------
> | ,2
> |
> |
> | i use this command to print to file:
> | UTL_FILE.PUT_LINE(id_file_rend,buf);
> | and i need the leading ZERO before of comma, something like this
> | 0,2
> | i used the TO_CHAR in this way:
> | SQL> select rate,TO_CHAR(rate,'0.0000')
> | 2 from al_activity
> | 3 where activity_type = 'LV'
> | 4 and input_date = TRUNC(SYSDATE);
> |
> | RATE TO_CHAR
> | ---------- -------
> | 1,5 1.5000
> | 1 1.0000
> | 1 1.0000
> | ,2 0.2000
> | ,1 0.1000
> | ,2 0.2000
> |
> | That's good for the leading number, but i do't want to show others zero
> | not-significant,
> | please suggest me the solution to both show the leading number is rate
> | is < 1 and how to trim the not important zero,
> | thank you so much, all you are great!!!
> | love
> | siddhana
> |
>
> TO_CHAR(rate,'FM0D9999')
> 
> Regards
> Michel Cadot

Perfect, THANks a lot!!! Received on Tue Nov 21 2006 - 05:57:41 CST

Original text of this message

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