Search code examples
oracle-databasecurrencynumber-formatting

Oracle SQL - change decimal dot for a comma


I'm on Brazil, and our currency format is something like 'R$ 9.999,00'.

I'm trying to select a field, and change the format of the return. However, it seems I can't do it. I've tried:

ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ',.';

and

SELECT to_char(10,'9,999.00', 'NLS_NUMERIC_CHARACTERS = '',.''') FROM DUAL

None of those worked. Not sure if it might be my client (I'm on Ubuntu using sqldeveloper), or if I'm doing something wrong.

Any ideas?


Solution

  • Use

    SELECT to_char(10,'9G990D00', 'NLS_NUMERIC_CHARACTERS = '',.''') FROM DUAL
    

    G is symbol for thousands separator D is for decimal separator