Обсуждение: Formatting numbers in psql?

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

Formatting numbers in psql?

От
Holger Marzen
Дата:
Hi *,

can I format numbers in psql output with decimal separators, say 1234567
will be displayed as 1.234.567 or 1,234,567?

Regards
Holger

--
PGP/GPG Key-ID:
http://blackhole.pca.dfn.de:11371/pks/lookup?op=get&search=0xB5A1AFE1


Re: Formatting numbers in psql?

От
Karel Zak
Дата:
On Thu, Sep 26, 2002 at 10:52:11PM +0200, Holger Marzen wrote:
> Hi *,
>
> can I format numbers in psql output with decimal separators, say 1234567
> will be displayed as 1.234.567 or 1,234,567?

 G = group by locale
 D = decimal point be locale

test=# select to_char(123456789.012, '999G999G999D999');
     to_char
------------------
  123 456 789,012
(1 row)


 - on locale independent:

test=# select to_char(123456789.012, '999,999,999.999');
     to_char
------------------
  123,456,789.012
(1 row)

    Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz