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: Leading zeros for numbers between 0 and 1

Re: Leading zeros for numbers between 0 and 1

From: Michael Mauch <michael.mauch_at_gmx.de>
Date: Sat, 17 Nov 2001 17:25:16 +0000
Message-ID: <sh66t9.jhi.ln@elmicha.333200002251-0001.dialin.t-online.de>


Jim Kennedy <kennedy-family_at_home.com> wrote:
> Look at the to_char function. I believe that one of the formats allows a
> leading zero.
> e.g. to_char(field,'0.99') which will give a leading zero and 2 decimal
> places.

Thank you for your suggestion, but I'm afraid to_char() isn't much easier: either the user of my export program supplies the appropriate to_char() around all of the numeric columns, or my program has to apply to_char() to all numeric columns.

If there was a way to set a predefined to_char() "format model" which is automatically applied to all numeric data, this would be much better.

For date fields there is NLS_DATE_FORMAT, but there doesn't seem to exist such a default setting for number fields.

And then, I'm afraid I can't find a format model that works just like the default model 'TM9', but places a zero before the decimal point if the value is between 0 and 1 or between -1 and 0.

It looks like all other models have a fixed number of digits, so I get superfluous zeros, rounding or even ###'ing.

Do you know a format model that prints numbers in the following manner?

0
0.1
-0.1

10000000000000000
0.000000000000000001

Regards...
		Michael
Received on Sat Nov 17 2001 - 11:25:16 CST

Original text of this message

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