Search Postgresql Archives

Re: How to convert numbers into words in postgresql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/14/2013 03:27 PM, Merlin Moncure wrote:
On Tue, May 14, 2013 at 5:24 PM, Adrian Klaver <adrian.klaver@xxxxxxxxx> wrote:

Seems to only work with money type.

from the source:
/* cash_words()
  * This converts a int4 as well but to a representation using words
  * Obviously way North American centric - sorry
  */
Datum
cash_words(PG_FUNCTION_ARGS)
{

Well Pg 9.0 did not get that memo:)

test=> SELECT version();
version
----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.13 on i686-pc-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.7.1 20120723 [gcc-4_7-branch revision 189773], 32-bit
(1 row)

test=> SELECT cash_words(123);
ERROR:  function cash_words(integer) does not exist
LINE 1: SELECT cash_words(123);
               ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

Though using text works:

test=> SELECT cash_words('123');
                   cash_words
-------------------------------------------------
 One hundred twenty three dollars and zero cents



so, it comes down to the money type is one of the more bizarre things
left from postgres past and we try not to advertise too loudly I
suppose.

Agreed.


merlin



--
Adrian Klaver
adrian.klaver@xxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux