NLS_LANG与NLS_LANGUAGE的区别
来源:互联网 发布:华为网络交换机 编辑:程序博客网 时间:2024/05/22 12:08
NLS_LANG是环境变量,包括3部分NLS参数:NLS_LANGUAGE, NLS_TERRITORY, NLS_CHARACTERSET,需要在启动SQLPLUS等工具之前设置;
NLS_LANGUAGE主要控制SESSION中提示消息的语言,可以使用ALTER SESSION在SQLPLUS里面设置;
NLS_TERRITORY主要控制SESSION中的日期和货币等本地化参数的现实格式,也可以像NLS_LANGUAGE一样在 SESSION 里面设置;
NLS_CHARACTERSET控制客户端的字符集,不能在SESSION里面进行设置,只能通过NLS_LANG环境变量的方式进行设置。
2. 设置方法:
2.1 环境变量设置(windows),下划线必须和territory配对,点必须和字符集配对
set nls_lang=american_america.utf8
set nls_lang=american / set nls_lang=american_ / set nls_lang=american_.
set nls_lang=_america
set nls_lang=.utf8
2.2 SESSION设置
alter session set nls_language='american' nls_territory='america';
alter session set nls_language='american';
alter session set nls_territory='america';
3. 注意事项:
NLS_CHARACTERSET设置不当会导致数据不能正常显示:
- C:\>set nls_lang
- 环境变量 nls_lang 没有定义
- C:\>sqlplus system/oracle@ora1
- SQL*Plus: Release 11.2.0.1.0 Production on 星期六 5月 12 14:27:23 2012
- Copyright (c) 1982, 2010, Oracle. All rights reserved.
- 连接到:
- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- SQL> select * from v$nls_parameters where parameter in
- 2 ( 'NLS_LANGUAGE','NLS_TERRITORY','NLS_CHARACTERSET');
- PARAMETER VALUE
- -------------------- --------------------
- NLS_LANGUAGE SIMPLIFIED CHINESE
- NLS_TERRITORY CHINA
- NLS_CHARACTERSET AL32UTF8
- SQL> create table t(id number,name varchar2(20));
- 表已创建。
- SQL> insert into t values(1,'测试');
- 已创建 1 行。
- SQL> commit;
- 提交完成。
- SQL> select * from t;
- ID NAME
- ---------- ----------------------------------------
- 1 测试
- SQL> exit
- 从 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开
- C:\>set nls_lang=.WE8ISO8859P1
- C:\>sqlplus system/oracle@ora1
- SQL*Plus: Release 11.2.0.1.0 Production on Sat May 12 14:29:27 2012
- Copyright (c) 1982, 2010, Oracle. All rights reserved.
- Connected to:
- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, OLAP, Data Mining and Real Application Testing options
- SQL> select * from t;
- ID NAME
- ---------- --------------------
- 1 靠
- SQL>
REF:
1. Setting Up a Globalization Support Environment
http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch3globenv.htm#NLSPG189
- NLS_LANG与NLS_LANGUAGE的区别
- NLS_LANG与NLS_LANGUAGE的区别
- NLS_LANG与NLS_LANGUAGE的区别
- LINUX+ORACLE 字符集 语言 相关区别:LANG NLS_LANG NLS_LANGUAGE characterset
- LINUX+ORACLE 字符集 语言 相关区别:LANG NLS_LANG NLS_LANGUAGE characterset
- nls_lang、nls_language、nls_char…
- LANG和NLS_LANG的区别
- LANG和NLS_LANG的区别
- oracle的字符集(NLS_LANGUAGE)
- oracle的字符集(NLS_LANGUAGE)
- oracle的字符集(NLS_LANGUAGE)
- LANG与NLS_LANG
- NLS_LANG的问题
- 查看 NLS_LANG 的方法
- 坑爹的NLS_LANG
- 查看NLS_LANG的方法
- nls_lang
- nls_lang
- ios动态获取UILabel的高度和宽度
- Android Volley分析(一)——结构
- scrollView嵌套listView,重新设置listview高度解决冲突,但打开activity之后,初始位置不是顶部解决方案
- Java程序员的PHP印象
- 机器学习10大经典算法
- NLS_LANG与NLS_LANGUAGE的区别
- Same Tree
- AutoIT生成SQL语句
- 各大IT公司校园招聘程序猿笔试、面试题集锦
- url带参数防止culr抓取问题
- Swift中的懒加载—@lazy
- Python学习——leetcode(Merge Two Sorted Lists )
- Swift基础--使用TableViewController自定义列表
- Linux下常用程序的代理服务器(proxy)配置