Re: Force TO_CHAR to eliminate the leading blank during display

From: <sstephen_at_us.oracle.com>
Date: Wed, 14 Oct 1992 21:59:45 GMT
Message-ID: <1992Oct14.135945.1_at_us.oracle.com>


In article <38330_at_arctic.nprdc.navy.mil>, loffredo_at_nprdc.navy.mil (Rick Loffredo) writes:
> I wrote a small SQLPLUS script to convert the Oracle data to an ASCII file.
> As you can see from the script, I had 1 numeric field in the table. In
> addition, I also put out 4 '|'s as field delimiters. QUESTION: How come there
> is alwayw an extra blank preceeding the numeric field (Argument_Number), even
> though I explicitly set "space 0", and provided the TO_CHAR function with a
> format of '09'.
>
(SQL*Plus script deleted)

I had always assumed that the leading space was a "place holder" for the "sign". If you try the same TO_CHAR on negative numbers, you get no leading spaces, only a leading "-". I guess this makes it easier if you don't want a sign, (just truncate the first character, ALWAYS). If they had stripped off the leading blanks, you would have to truncate if negative... You can move the space around, though : 09MI would give you |01 |, 09PR would give you | 01 |.

-- 
================================================================================
Scott Stephens				inet:	sstephen.us.oracle.com
Oracle WorldWide Support                Redwood City, California
Received on Wed Oct 14 1992 - 22:59:45 CET

Original text of this message