Re: [SQL] Type Conversion: int4 -> Money

Поиск
Список
Период
Сортировка
От Mark Wright
Тема Re: [SQL] Type Conversion: int4 -> Money
Дата
Msg-id 001701befb99$c345c450$c62812ac@markw_compaq
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] runaway backend process
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] runaway backend process