function returning a readable representation of a number

Поиск
Список
Период
Сортировка
Искать

function returning a readable representation of a number

От:
"Najib Abi Fadel" <nabifadel@usj.edu.lb>
Дата:
Is there any postgres function that do the following:
 
select func(9123456789);
9 123 456 789
 
the function is given a number and it returns a "readable" string representation of the number seperating groups of 3 numbers by spaces.
 
Thx

Re: function returning a readable representation of a number

От:
"gnari" <gnari@simnet.is>
Дата:
Sent: Tuesday, July 13, 2004 10:07 AM
Subject: [GENERAL] function returning a readable representation of a number

> Is there any postgres function that do the following:
> 
> select func(9123456789);
> 9 123 456 789
 
you mean like
 
select to_char(9123456789,'999 999 999 999');
 
?
 
gnari
 

Re: function returning a readable representation of a number

От:
Mike G <mike@thegodshalls.com>
Дата:
Nope.

You can create one though.

Mike

On Tue, Jul 13, 2004 at 12:07:17PM +0200, Najib Abi Fadel wrote:
> Is there any postgres function that do the following:
> 
> select func(9123456789);
> 9 123 456 789
> 
> the function is given a number and it returns a "readable" string representation of the number seperating groups of 3 numbers by spaces.
> 
> Thx

Re: function returning a readable representation of a number

От:
CoL <col@mportal.hu>
Дата:
hi,

Najib Abi Fadel wrote:
> 
> Is there any postgres function that do the following:
>  
> select func(9123456789);
> 9 123 456 789
>  
> the function is given a number and it returns a "readable" string 
> representation of the number seperating groups of 3 numbers by spaces.

you can write it for your own, but here is one:
http://gear.hu/files/resources/postgresql/number_format.sql

C.
FAQ