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: Function TO_CHAR

Re: Function TO_CHAR

From: Tim Kearsley <tim.kearsley_at_milton-keynes.gov.uk>
Date: 4 Nov 2004 07:08:34 -0800
Message-ID: <725736ef.0411040708.3075c71e@posting.google.com>


Hello,

The leading blank space is a place-holder for the sign (i.e. + or -), convention being that a positive number is implied if no implicit sign is shown.

If you specifically want to remove the leading space there are various options. One of the simplest is to precede your format mask with "fm" thus:

TO_CHAR(15,'fm0999') returns '0015') (at least in 9.2.0.4 it does!)

The other aspect to this is that if you want to force a sign to be shown, whether it is negative or positive, this can be done with:

TO_CHAR(15,'S0999') returns '+0015'

Regards,

Tim Kearsley
HBS Milton Keynes

"Petr Benes" <benes_at_epos.cd.cz> wrote in message news:<4189e1f4.0_at_10.140.56.22>...
> Hi
>
> Expression TO_CHAR(15) returns '15'. It is correct.
> Expression TO_CHAR(15,'0999') returns ' 0015' instead '0015'.
> Tested in version 10q as well as 7.3.4.
>
> Do you know why there is the blankspace?
>
> Thanks
Received on Thu Nov 04 2004 - 09:08:34 CST

Original text of this message

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