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: Jurij Modic <jmodic_at_src.si>
Date: Sun, 07 Feb 1999 20:18:22 GMT
Message-ID: <36bdf05b.1708935@news.siol.net>


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

>Hello all of you!
>
>When I do the following in PL/SQL:
>
><string> := TO_CHAR(<number>, '00');
>
>The <string> is declared as a CHAR(2) and <number> as a NUMBER(2,0).
><number> always contains 1 - 99.
>
>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?

The extra blank is reserved for a sign character - in the case of the negative numbers you would get '-' sign there.

You can avoid this extra blank for positive numbers by adding "FM" format modifier to your format mask, eg

   <string> := TO_CHAR((<number>, 'FM09')

>Regards
>
>/\/\attias

HTH,
Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Sun Feb 07 1999 - 14:18:22 CST

Original text of this message

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