Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Odd results from TO_CHAR()
Which means the statement can be rewritten as:
select 'x'||to_char( 1,'S00')||'x' from dual;
This indeed returns x+01x
Or:
select 'x'||to_char(-1,'S00')||'x' from dual;
which returns x-01x
Andrew
In article <36ae2980.537572_at_192.86.155.100>,
tkyte_at_us.oracle.com wrote:
> 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.
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Mon Feb 01 1999 - 23:39:39 CST