将货币符号 £, $ 添加到某些字段 ORACLE
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2717686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Add Currency Sign £, $ to certain fields ORACLE
提问by APC
I want to display the dollar or pound sign in my fields that hold job_salary any one knows? how to
我想在我的包含 job_salary 的字段中显示美元或英镑符号,有人知道吗?如何
回答by APC
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 (£).
使用$
格式掩码一个硬编码美元符号(毕竟甲骨文是一家美国公司)。其他货币由 NLS_TERRITORY 的设置决定。用C
看ISO货币缩写(UKP),并L
为符号(£)。
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
...
回答by JoshL
My preference is:
我的偏好是:
select to_char(123456789.91, 'FM9,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.
根据需要将格式字符串构建为任意数量的数字。FM 跳过前导空格以说明负数对齐。
select to_char((123456789.91, 'FM999,999,999,990.00C') from dual;
从双中选择 to_char((123456789.91, 'FM999,999,999,990.00C');
This will get the ISO value trimming the leading space
这将获得修剪领先空间的 ISO 值