| From: | "Greg Sabino Mullane" <greg(at)turnstep(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Cc: | sweet(dot)rinky72(at)gmail(dot)com |
| Subject: | Re: How to convert numbers into words in postgresql |
| Date: | 2013-05-15 04:24:13 |
| Message-ID: | cfc5be314920557d05685ae3d05eb074@biglumber.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Jashaswee asked:
> i want to convert numbers into words in postgresql.
> is there any query for it?
Easy enough with PlPerl:
$ sudo apt-get install liblingua-en-inflect-perl
$ createlang plperlu
$ psql <<eot
> create or replace function numwords(int)
> returns text
> language plperlu
> immutable
> as '
> use Lingua::EN::Inflect qw( NUMWORDS );
> return NUMWORDS(shift);
> ';
> eot
CREATE FUNCTION
$ psql -tc 'select numwords(1234)'
one thousand, two hundred and thirty-four
- --
Greg Sabino Mullane greg(at)turnstep(dot)com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201305150015
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iEYEAREDAAYFAlGTDFwACgkQvJuQZxSWSsgpIACgyXX3Bt3SMDje/5V+tzSMESD+
HdsAmwZpYqWgnZeZvmEn8jclUCQzdKTG
=x9DW
-----END PGP SIGNATURE-----
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2013-05-15 04:25:52 | Re: dblink does not resolve DNS, but works with IP |
| Previous Message | Mike Christensen | 2013-05-15 04:17:02 | dblink does not resolve DNS, but works with IP |