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: Odd results from TO_CHAR()

Re: Odd results from TO_CHAR()

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 26 Jan 1999 02:34:00 GMT
Message-ID: <36ae2980.537572@192.86.155.100>


A copy of this was sent to pbolduc_at_online-can.com (if that email address didn't require changing) On Tue, 26 Jan 1999 01:50:01 GMT, you wrote:

>
>
>Why does this happen:
>
> select 'x'||to_char(1,'00')||'x' from dual;
>
> returns: 'x 01x'

its room for the sign:

SQL> select 'x' || to_char(-1,'00')||'x' from dual;

'X'||



x-01x

SQL> c/-1/1/
  1* select 'x' || to_char(1,'00')||'x' from dual SQL> / 'X'||



x 01x

SQL> there is an implicit sign field on that format.

>
>I would have expected: 'x01x'
>
>I know I could do: select 'x'||ltrim(to_char(1,'00'))||'x' from dual;
>to get the same result but it seems convoluted.
>
>Oracle7 Server Release 7.3.2.3.0 - Production Release
>PL/SQL Release 2.3.2.3.0 - Production
>CORE Version 3.5.2.0.0 - Production
>TNS for HPUX: Version 2.3.2.1.0 - Production
>NLSRTL Version 3.2.2.0.0 - Production
>
>Phil Bolduc
>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Jan 25 1999 - 20:34:00 CST

Original text of this message

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