Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Number to Char conversion
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
>
>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