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: Number to Char conversion

Re: Number to Char conversion

From: Jonathan Gennick <gennick_at_worldnet.att.net>
Date: 9 Feb 1999 05:02:11 GMT
Message-ID: <36c16a05.3841780@netnews.worldnet.att.net>


On 7 Feb 1999 18:05:24 +0100, mattias.meyer_at_t-online.de (mme) wrote:

>When I do the following in PL/SQL:
>
><string> := TO_CHAR(<number>, '00');

<snip>
>Why do I always get a errormessage saying the the conversion canīt be done?
>When I declare the <string> as a CHAR(3) it works... but I get a
>space/blank
>as first position of the string. How come?

Oracle is leaving one space for a leading sign. Convert a negative number, and you will see a "-" character in that position. Positive numbers get a space. This is by design. As you have already figured out, you must use LTRIM to eliminate that leading space.

regards,

Jonathan



Jonathan Gennick -- Oracle DBA, Author, Editor jonathan_at_gennick.com
http://gennick.com
Brighten the corner where you are.

>
>I then use
>LTRIM(<string>, ' ');
>but I wanna know why it works the way it does????
>
>Regards
>
>/\/\attias
>
Received on Mon Feb 08 1999 - 23:02:11 CST

Original text of this message

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