Thread: Changing point for commas and commas for point

Changing point for commas and commas for point

From
"Ezequias Rodrigues da Rocha"
Date:
Hi list,<br /><br />Here in my country (Brazil) we have the decimal simbol as ' , ' (commas) and thousand separator as
'. ' (point)<br clear="all" /> <br />Here my sql uses:  to_char(sum(My_column), '99990D00') <br /><br />Is there any
wayto make this happens ?<br /><br />Regards<br /><br />-- <br />
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br/>                                  Atenciosamente
(Sincerely)<br/>                        Ezequias Rodrigues da Rocha <br />
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<br/>A pior das democracias ainda é melhor do
quea melhor das ditaduras<br />The worst of democracies is still better than the better of dictatorships <br /><a
href="http://ezequiasrocha.blogspot.com/">http://ezequiasrocha.blogspot.com/</a>

Re: Changing point for commas and commas for point

From
Tom Lane
Date:
"Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com> writes:
> Here in my country (Brazil) we have the decimal simbol as ' , ' (commas) and
> thousand separator as ' . ' (point)

> Here my sql uses:  to_char(sum(My_column), '99990D00')

That's the right thing.

> Is there any way to make this happens ?

I think you forgot to set LC_NUMERIC.

regression=# select to_char(42.45, '99990D00'); to_char
-----------    42.45
(1 row)

regression=# set lc_numeric TO 'pt_PT.iso88591';
SET
regression=# select to_char(42.45, '99990D00'); to_char
-----------    42,45
(1 row)

The specific locale names available vary across OSes ... try "locale -a"
for a list.
        regards, tom lane


Re: Changing point for commas and commas for point

From
Andreas Kretschmer
Date:
Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com> schrieb:

> Hi list,
> 
> Here in my country (Brazil) we have the decimal simbol as ' , ' (commas) and
> thousand separator as ' . ' (point)
>  
> Here my sql uses:  to_char(sum(My_column), '99990D00')
> 
> Is there any way to make this happens ?

I think, you can use the 'G' as a group separator for this:

test=*# select to_char(12345.67, '999G990D00');  to_char
-------------  12.345,67
(1 row)


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."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°