1
I have a column of type text '1534,99', that is with the number in the Portuguese format. How do I use the function to_number
in that case?
SELECT TO_NUMBER('1534,99','9999999D99')
should work if it was the "." instead of the ","
1
I have a column of type text '1534,99', that is with the number in the Portuguese format. How do I use the function to_number
in that case?
SELECT TO_NUMBER('1534,99','9999999D99')
should work if it was the "." instead of the ","
2
The D the format '9999999D99' represents the decimal point and this is based on the locale of your database. Postgresql uses the dot as decimal separator due to American standard.
One possibility without changing the locale is to use Function REPLACE:
SELECT TO_NUMBER(REPLACE('1534,99', ',','.'),'9999999D99');
Sources: lc_numeric formatting patterns
Browser other questions tagged postgresql
You are not signed in. Login or sign up in order to post.