pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Formatting zeroes
3+ messages / 3 participants
[nested] [flat]

* Formatting zeroes
@ 2002-09-16 14:41  Ludwig Lim <lud_nowhere_man@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Ludwig Lim @ 2002-09-16 14:41 UTC (permalink / raw)
  To: pgsql-sql

Hi:

  I'm trying to use SQL to generate a formatted
report. The "to_char(numeric,'FM9,999,999,999.99')"
function works when I use it format numbers with
decimal points and appropriate commas.
  
   However my problem is when I encounter a row has a
zero for one its column. It displays "0.", I tried
using with other formatting options but it does not
display zero the way I like ( "0" or "0.0").

  Is there a format specifier in the to_char function
that it will display 0 as "0" or "0.0"?

thanks,

ludwig.


__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Formatting zeroes
@ 2002-09-16 15:52  Josh Berkus <josh@agliodbs.com>
  parent: Ludwig Lim <lud_nowhere_man@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Josh Berkus @ 2002-09-16 15:52 UTC (permalink / raw)
  To: Ludwig Lim <lud_nowhere_man@yahoo.com>; pgsql-sql

Ludwig,

>   I'm trying to use SQL to generate a formatted
> report. The "to_char(numeric,'FM9,999,999,999.99')"
> function works when I use it format numbers with
> decimal points and appropriate commas.
>   Is there a format specifier in the to_char function
> that it will display 0 as "0" or "0.0"?

"to_char(numeric,'FM9,999,999,999.09')"

-Josh Berkus



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Formatting zeroes
@ 2002-09-17 05:33  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2002-09-17 05:33 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: Ludwig Lim <lud_nowhere_man@yahoo.com>; pgsql-sql

Josh Berkus wrote:
> Ludwig,
> 
> >   I'm trying to use SQL to generate a formatted
> > report. The "to_char(numeric,'FM9,999,999,999.99')"
> > function works when I use it format numbers with
> > decimal points and appropriate commas.
> >   Is there a format specifier in the to_char function
> > that it will display 0 as "0" or "0.0"?
> 
> "to_char(numeric,'FM9,999,999,999.09')"

And we know it is a bug:

  * to_char(0,'FM999.99') returns a period, to_char(1,'FM999.99') does not

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-09-17 05:33 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-16 14:41 Formatting zeroes Ludwig Lim <lud_nowhere_man@yahoo.com>
2002-09-16 15:52 ` Josh Berkus <josh@agliodbs.com>
2002-09-17 05:33   ` Bruce Momjian <pgman@candle.pha.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox