Path: dp-news.maxwell.syr.edu!spool.maxwell.syr.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub.sdsu.edu!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail
From: "SteveC" <stevec@sfsu.edu>
Newsgroups: comp.databases.oracle.server
Subject: Re: Simple SQL question
Date: 2 Feb 2006 13:13:18 -0800
Organization: http://groups.google.com
Lines: 52
Message-ID: <1138914798.066199.87450@g14g2000cwa.googlegroups.com>
References: <MPG.1e49a4898817539498a0d2@news.individual.net>
   <1138826128.935266.211190@g47g2000cwa.googlegroups.com>
   <6fSdnTeGKt2GgnzeRVn-hg@comcast.com>
NNTP-Posting-Host: 129.8.175.52
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1138914803 5836 127.0.0.1 (2 Feb 2006 21:13:23 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 2 Feb 2006 21:13:23 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: g14g2000cwa.googlegroups.com; posting-host=129.8.175.52;
   posting-account=94zw7w0AAAB_7quSBixAd7z2nKx82wQF
Xref: dp-news.maxwell.syr.edu comp.databases.oracle.server:260611

fm in the format mask is a useful tool for removing the leading space
reserved for the minus sign, and in other situations.  I created a
little test, and found it also removes trailing zeros following a
decimal point.

The following test would look better if I could format my message to
fixed-spaced text:

SQL> Declare
  2    procedure Tst( n in number, fmt in varchar2) is begin
  3      dbms_output.put_line
  4        (lpad(to_char(n),8) || lpad(fmt,10)
  5         || ' |' || to_char(n,fmt) ||'|'      );
  6    end Tst;
  7  Begin
  8    Tst(0, '999');
  9    Tst(0, 'fm999');
 10    Tst(0, '000');
 11    Tst(0, 'fm000');
 12    Tst(-123, '999');
 13    Tst(-123, 'fm999');
 14    Tst(123,  '999');
 15    Tst(123,  'fm999');
 16    Tst(1.2,  '999.99');
 17    Tst(1.2,  'fm999.99');
 18    Tst(-1.2, '990.00');
 19    Tst(-1.2, 'fm990.00');
 20    Tst(1.2,  '990.099');
 21    Tst(1.2,  'fm990.099');
 22    Tst(1.2,  '000.000');
 23    Tst(1.2,  'fm000.000');
 24  End;
 25  /
       0       999 |   0|
       0     fm999 |0|
       0       000 | 000|
       0     fm000 |000|
    -123       999 |-123|
    -123     fm999 |-123|
     123       999 | 123|
     123     fm999 |123|
     1.2    999.99 |   1.20|
     1.2  fm999.99 |1.2|
    -1.2    990.00 |  -1.20|
    -1.2  fm990.00 |-1.20|
     1.2   990.099 |   1.200|
     1.2 fm990.099 |1.2|
     1.2   000.000 | 001.200|
     1.2 fm000.000 |001.200|

PL/SQL procedure successfully completed.

