Re: [SQL] Type Conversion: int4 -> Money - Mailing list pgsql-sql

From Mark Wright
Subject Re: [SQL] Type Conversion: int4 -> Money
Date
Msg-id 001701befb99$c345c450$c62812ac@markw_compaq
Whole thread Raw
List pgsql-sql
-----Original Message-----
From: secret <secret@kearneydev.com>
To: Herouth Maoz <herouth@oumail.openu.ac.il>
Cc: pgsql-sql@postgreSQL.org <pgsql-sql@postgreSQL.org>
Date: Thursday, September 09, 1999 3:31 PM
Subject: Re: [SQL] Type Conversion: int4 -> Money


>Herouth Maoz wrote:
>

...

>    Perl... I ended up writing my own formatting function... It has one
that
>does ####.## however not one that'll do the nice 123,456.33 ... :)  Do you
know
>if there are any public modules that do such things?


from the Perl Cookbook (a Perl-programmer must have!):   sub commify   {       my $text = reverse $_[0];       $text =~
s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;      return scalar reverse $text;   }
 

If you want a locale-using solution, and can use C, there's code in the
pgsql source that does this.  Look at:
   /src/backend/utils/adt/cash.c cash_out()





pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [SQL] runaway backend process
Next
From: Tom Lane
Date:
Subject: Re: [SQL] runaway backend process