Re: decimal seperator

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: decimal seperator
Дата
Msg-id 20110105154346.GA7983@tux
обсуждение исходный текст
Ответ на decimal seperator  (Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>)
Список pgsql-novice
Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com> wrote:

> Hi,
>
> is there a way to change the way how postgresql outputs floating point numbers?

Yeah, you can and should use to_char(), example:

test=# select to_char(2.34,'999D99');
 to_char
---------
    2.34
(1 Zeile)

Zeit: 0,153 ms
test=*# set lc_numeric = 'de_DE.UTF-8';
SET
Zeit: 0,122 ms
test=*# select to_char(2.34,'999D99');
 to_char
---------
    2,34
(1 Zeile)


It works also for the group separator:

test=*# select to_char(1234567.89,'999G999G999D99');
     to_char
-----------------
    1.234.567,89


You have to use to_char(), but i think, this is exactly what you are
looking for.

>
> Can this be adjusted per session?

Sure ;-)


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

В списке pgsql-novice по дате отправления:

Предыдущее
От: Susanne Ebrecht
Дата:
Сообщение: Re: decimal seperator
Следующее
От: Mladen Gogala
Дата:
Сообщение: Re: decimal seperator