我们知道,如果想把金额带上本位币,一般加上L,
比如:
select to_char(salary,'L99,9999.00') from employees;
下面显示如下:
SALARY TO_CHAR(SALARY,'L99,
---------- --------------------
2900 ¥2,900.00
2500 ¥2,500.00
4000 ¥4,000.00
3900 ¥3,900.00
3200 ¥3,200.00
2800 ¥2,800.00
3100 ¥3,100.00
3000 ¥3,000.00
在windows客户端一般都没有问题,但在linux下,其结果为:
TO_CHAR(SALARY,'L99,9
---------------------
$2900.00
$2500.00
$4000.00
$3900.00
$3200.00
$2800.00
$3100.00
$3000.00
我们要设置为中文的人民币,只需要在linux下,设置:
nls_lang的区域为china即可.
export NLS_LANG=_CHINA.zhs16gbk
[oracle@dbserver ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sun May 8 17:50:43 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> select to_char(15000,'L99,999.00') from dual;
TO_CHAR(15000,'L99,9
--------------------
¥15,000.00
SQL> show parameter nls_
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_currency string ¥
nls_date_language string AMERICAN
nls_dual_currency string ¥
nls_iso_currency string CHINA
nls_language string AMERICAN
nls_sort string BINARY
nls_territory string CHINA
|