简体   繁体   中英

Change number output [.] to [,] in pl/sql

I've function that should change notation of numbers from 12345.67€ to 12345,67€

 select

        replace(
    to_char(round(

    123456.789

    ,2),'999G999G999G990D'||substr('0000000000',1,2),'nls_numeric_characters=''.,'''),'.',','
    ) || ' €' 

    from dual;

current result is: 123,456,79 € the result I want to get: 123456,79 €

But I' dont know how. My oracle returns values in format 123456.79 so this is a reason of my calculation. Doe's anybody know what to do?

ALTER SESSION SET NLS_TERRITORY='SWEDEN' for an example. Or Estonia.
Numeric formats are derived from the setting of the NLS_TERRITORY parameter, but they can be overridden by the NLS_NUMERIC_CHARACTERS parameter.

You should either set the NLS parameters, if they are not already correct, in the session or in the query eg

select to_char(123456.789
              ,'9999990D00L'
              ,'nls_numeric_characters='',.'' nls_currency=''€''')
from dual
select

replace(
to_char(round(

123456.789

,2),'999999999990D'||substr('0000000000',1,2),'nls_numeric_characters=''.,'''),'.',','
) || ' €' 

from dual;   

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM