Add Currency Sign £, $ to certain fields ORACLE

落花浮王杯 提交于 2019-11-27 06:33:51

问题


I want to display the dollar or pound sign in my fields that hold job_salary any one knows? how to


回答1:


Using $ in the format mask hardcodes a dollar sign (after all, Oracle is an American corporation). Other currencies are determined by the setting for NLS_TERRITORY. Use C to see the ISO currency abbreviation (UKP) and L for the symbol (£).

SQL> select to_char(sal, 'C999,999.00') as ISO
  2         , to_char(sal, 'L999,999.00') as symbol from emp
  3  /

ISO                SYMBOL
------------------ ---------------------
       GBP3,500.00             £3,500.00
       GBP3,750.00             £3,750.00 

...



回答2:


My preference is:

select to_char(123456789.91, 'FM$999,999,999,990.00')
  from dual;

Build the format string out to as many digits as you need. The FM skips the leading space to account for negative number alignment.

select to_char((123456789.91, 'FM999,999,999,990.00C') from dual;

This will get the ISO value trimming the leading space



来源:https://stackoverflow.com/questions/2717686/add-currency-sign-%c2%a3-to-certain-fields-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!