【Oracle】详解Oracle中NLS_LANG变量的使用
目录结构:
1,关于NLS_LANG参数
Oracle provides Globalization Support that enables users to interact with a database in their own language, as defined by the NLS_LANG parameter. When you install Oracle Database Client components, Oracle Universal Installer sets the NLS_LANG parameter in the registry.
The locale setting of your operating system determines the value of the NLS_LANG parameter at installation. Table C-1 lists the operating system locale and NLS_LANG value mappings.
The NLS_LANG parameter is stored in the registry under the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEID\NLS_LANG subkey, where ID is the unique number identifying the Oracle home.
The NLS_LANG parameter uses the following format:
NLS_LANG = LANGUAGE_TERRITORY.CHARACTER_SET
Oracle提供全球化的支持,通过定义NLS_LANG参数能够让用户用他们自己的语言使用数据库。当安装Oracle数据库客户端的时候,安装程序通常会在注册表中设置NLS_LANG参数。
在安装中,操作系统的区域设置会决定NLS_LANG参数的值。表C-1列出了操作系统区域和NLS_LANG的对照表。
NLS_LANG参数被存储在注册表中的HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEID\NLS_LANG子项下,其中ID是识别Oracle home的唯一数字。
NLS_LANG参数使用如下的格式:
NLS_LANG = LANGUAGE_TERRITORY.CHARACTER_SET
where:
| Parameter | Description |
|---|---|
LANGUAGE |
Specifies the language and conventions for displaying messages, day name, and month name. |
TERRITORY |
Specifies the territory and conventions for calculating week and day numbers. |
CHARACTER_SET |
Controls the character set used for displaying messages. |
2 NSL_LANG常用的值
Table C-1 lists commonly used NLS_LANG values for various operating system locales:
Table C-1 NLS_LANG Parameter Values
| Operating System Locale | NLS_LANG Value |
|---|---|
| Arabic (U.A.E.) | ARABIC_UNITED ARAB EMIRATES.AR8MSWIN1256 |
| Bulgarian | BULGARIAN_BULGARIA.CL8MSWIN1251 |
| Catalan | CATALAN_CATALONIA.WE8MSWIN1252 |
| Chinese (PRC) | SIMPLIFIED CHINESE_CHINA.ZHS16GBK |
| Chinese (Taiwan) | TRADITIONAL CHINESE_TAIWAN.ZHT16MSWIN950 |
| Croatian | CROATIAN_CROATIA.EE8MSWIN1250 |
| Czech | CZECH_CZECH REPUBLIC.EE8MSWIN1250 |
| Danish | DANISH_DENMARK.WE8MSWIN1252 |
| Dutch (Netherlands) | DUTCH_THE NETHERLANDS.WE8MSWIN1252 |
| English (United Kingdom) | ENGLISH_UNITED KINGDOM.WE8MSWIN1252 |
| English (United States) | AMERICAN_AMERICA.WE8MSWIN1252 |
| Estonian | ESTONIAN_ESTONIA.BLT8MSWIN1257 |
| Finnish | FINNISH_FINLAND.WE8MSWIN1252 |
| French (Canada) | CANADIAN FRENCH_CANADA.WE8MSWIN1252 |
| French (France) | FRENCH_FRANCE.WE8MSWIN1252 |
| German (Germany) | GERMAN_GERMANY.WE8MSWIN1252 |
| Greek | GREEK_GREECE.EL8MSWIN1253 |
| Hebrew | HEBREW_ISRAEL.IW8MSWIN1255 |
| Hungarian | HUNGARIAN_HUNGARY.EE8MSWIN1250 |
| Icelandic | ICELANDIC_ICELAND.WE8MSWIN1252 |
| Indonesian | INDONESIAN_INDONESIA.WE8MSWIN1252 |
| Italian (Italy) | ITALIAN_ITALY.WE8MSWIN1252 |
| Japanese | JAPANESE_JAPAN.JA16SJIS |
| Korean | KOREAN_KOREA.KO16MSWIN949 |
| Latvian | LATVIAN_LATVIA.BLT8MSWIN1257 |
| Lithuanian | LITHUANIAN_LITHUANIA.BLT8MSWIN1257 |
| Norwegian | NORWEGIAN_NORWAY.WE8MSWIN1252 |
| Polish | POLISH_POLAND.EE8MSWIN1250 |
| Portuguese (Brazil) | BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252 |
| Portuguese (Portugal) | PORTUGUESE_PORTUGAL.WE8MSWIN1252 |
| Romanian | ROMANIAN_ROMANIA.EE8MSWIN1250 |
| Russian | RUSSIAN_CIS.CL8MSWIN1251 |
| Slovak | SLOVAK_SLOVAKIA.EE8MSWIN1250 |
| Spanish (Spain) | SPANISH_SPAIN.WE8MSWIN1252 |
| Swedish | SWEDISH_SWEDEN.WE8MSWIN1252 |
| Thai | THAI_THAILAND.TH8TISASCII |
| Spanish (Mexico) | MEXICAN SPANISH_MEXICO.WE8MSWIN1252 |
| Spanish (Venezuela) | LATIN AMERICAN SPANISH_VENEZUELA.WE8MSWIN1252 |
| Turkish | TURKISH_TURKEY.TR8MSWIN1254 |
| Ukrainian | UKRAINIAN_UKRAINE.CL8MSWIN1251 |
| Vietnamese | VIETNAMESE_VIETNAM.VN8MSWIN1258 |
3 在MS-DOS模式和Batch模式中设置NLS_LANG
Before you can use Oracle utilities such as SQL*Plus, SQL Loader, Import, and Export in MS-DOS mode, make sure that you have set the character set field of the NLS_LANG parameter for the session to the correct value.
This is required because MS-DOS mode uses, with a few exceptions, a different character set (or code-page) from Windows (ANSI code-page), and the default Oracle home NLS_LANG parameter in the registry is always set to the appropriate Windows code-page. If you do not set the NLS_LANG parameter for the MS-DOS mode session correctly, incorrect character conversion can corrupt error messages and data.
For Japanese, Korean, Simplified Chinese, and Traditional Chinese, the MS-DOS code-page is identical to the ANSI code-page. In this case, you do not need to set the NLS_LANG parameter in MS-DOS mode.
Similarly, in batch mode, set the correct character set value of NLS_LANG by inserting a SET NLS_LANG command at the start of the batch procedure, according to the character set of the files to be processed in the procedure.
在你使用Oracle应用之前,比如在MS-DOS模式中使用SQL*Plus,SQL Loader,Import,和Export,确保你已经在本次会话中正确的设置了字符集属性和NLS_LANG参数属性。 这是必须的,因为MS-DOS模式的使用会带有一些的来着Windows(ANSI code-page)的不同字符集设置的异常,在注册表中默认的Oracle home NLS_LANG参数总是会被设置成适合Windows code-page的值。
如果你在MS-DOS模式中不正确的设置NLS_LANG参数的值,那么错误的字符转换将会损坏信息和数据。
对于日文,韩文,简体中文和繁体中文,MS—DOS code-page 和ANSI code-page的值一样。在这种情况下,你不需要在MS-DOS模式中设置NLS_LANG参数的值。 同样的,在Batch模式中,根据程序运行过程中被处理的文件字符,通过插入SET LANG_LANG 命令设置正确的NLS_LANG值。
Table C-2 lists the Oracle character sets that correspond to the MS-DOS mode for various operating system locales:
Table C-2 Oracle Character Sets for Operating System Locales
| Operating System Locale | Character Set |
|---|---|
| Catalan | WE8PC850 |
| Chinese (PRC) | ZHS16GBK |
| Chinese (Taiwan) | ZHT16MSWIN950 |
| Czech | EE8PC852 |
| Danish | WE8PC850 |
| Dutch | WE8PC850 |
| English (United Kingdom) | WE8PC850 |
| English (United States) | US8PC437 |
| Finnish | WE8PC850 |
| French | WE8PC850 |
| German | WE8PC850 |
| Greek | EL8PC737 |
| Hungarian | EE8PC852 |
| Italian | WE8PC850 |
| Japanese | JA16SJIS |
| Korean | KO16MSWIN949 |
| Norwegian | WE8PC850 |
| Polish | EE8PC852 |
| Portuguese | WE8PC850 |
| Romanian | EE8PC852 |
| Russian | RU8PC866 |
| Slovak | EE8PC852 |
| Slovenian | EE8PC852 |
| Spanish | WE8PC850 |
| Swedish | WE8PC850 |
| Turkish | TR8PC857 |
| Catalan | WE8PC850 |
4,注册表中NLS_LANG和系统环境变量中的NLS_LANG
当用户安装好Oracle客户端后会在注册表中出现NLS_LANG的注册信息,在操作系统的环境变量中用户也可以设置自己的NLS_LANG的值。
但是需要注意:
注册表中的NLS_LANG是用于对应Oracle数据库与windows 的code-page值的,这个值是在安装的过程中自动添加的,一般不要去修改,如果修改后NLS_LANG的值与code-page的值不对应的话,会出现不同字符的异常。
系统环境变脸中NLS_LANG是用于对应Oracle数据显示的,这个值在安装完成后可能会有,也可能没有,是可以修改的,如果希望以中文显示则修改为 NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK ,也可以是英文的 NLS_LANG=AMERICAN_AMERICA.UTF8 ,建议在使用Oracle数据库之间将这里的NLS_LANG设置为英文显示。
5,参考文章
C Oracle Database Client Globalization Support
【Oracle】详解Oracle中NLS_LANG变量的使用的更多相关文章
- [转帖]【Oracle】详解Oracle中NLS_LANG变量的使用
[Oracle]详解Oracle中NLS_LANG变量的使用 https://www.cnblogs.com/HDK2016/p/6880560.html NLS_LANG=LANGUAGE_TERR ...
- [转帖]万字详解Oracle架构、原理、进程,学会世间再无复杂架构
万字详解Oracle架构.原理.进程,学会世间再无复杂架构 http://www.itpub.net/2019/04/24/1694/ 里面的图特别好 数据和云 2019-04-24 09:11:59 ...
- 详解Oracle手动创建数据库几大步骤
在这里我们将介绍Oracle手动创建数据库几大步骤,包括前期的准备工作,以及具体的实施. Oracle手动创建数据库是本文介绍的重点,希望通过本文能帮助大家更好的利用Oracle.51CTO也向您推荐 ...
- 用一个开发案例详解Oracle临时表
用一个开发案例详解Oracle临时表 2016-11-14 bisal ITPUB  一.开发需求 最近有一个开发需求,大致需要先使用主表,或主表和几张子表关联查询出ID(主键)及一些主表字段 ...
- [转帖]详解oracle数据库唯一主键SYS_GUID()
详解oracle数据库唯一主键SYS_GUID() https://www.toutiao.com/i6728736163407856139/ 其实 需要注意 这里满不能截取 因为截取了 就不一定唯一 ...
- 深入详解SQL中的Null
深入详解SQL中的Null NULL 在计算机和编程世界中表示的是未知,不确定.虽然中文翻译为 “空”, 但此空(null)非彼空(empty). Null表示的是一种未知状态,未来状态,比如小明兜里 ...
- 【转】详解C#中的反射
原帖链接点这里:详解C#中的反射 反射(Reflection) 2008年01月02日 星期三 11:21 两个现实中的例子: 1.B超:大家体检的时候大概都做过B超吧,B超可以透过肚皮探测到你内 ...
- 详解Webwork中Action 调用的方法
详解Webwork中Action 调用的方法 从三方面介绍webwork action调用相关知识: 1.Webwork 获取和包装 web 参数 2.这部分框架类关系 3.DefaultAction ...
- 【转】详解JavaScript中的this
ref:http://blog.jobbole.com/39305/ 来源:foocoder 详解JavaScript中的this JavaScript中的this总是让人迷惑,应该是js众所周知的坑 ...
- 详解Objective-C中委托和协议
Objective-C委托和协议本没有任何关系,协议如前所述,就是起到C++中纯虚类的作用,对于“委托”则和协议没有关系,只是我们经常利用协议还实现委托的机制,其实不用协议也完全可以实现委托. AD: ...
随机推荐
- 协程(Coroutine)并不是真正的多线程
自:http://www.zhihu.com/question/23895384 说到Coroutine,我们必须提到两个更远的东西.在操作系统(os)级别,有进程(process)和线程(threa ...
- SharePoint 2010/2013: List view Lookup threshold uncovered
SharePoint with Large lists is common scenario in any Sharepoint deployment. While there are Several ...
- 放入MP3的文件夹显示一些没用的标题,艺术家,唱片集怎么办?
原来的文件大小,类型,修改日期,创建日线都没了,怎么办? 右键点击名称,标题,艺术家那一行,在右键菜单中,去掉没用的,勾选有用的,如下图:
- 异步 JS: Callbacks, Listeners, Control Flow Libs 和 Promises【转载+翻译+整理】
http://sporto.github.io/blog/2012/12/09/callbacks-listeners-promises/ 或 http://www.ruanyifeng.com/bl ...
- Oracle数据表中输入引号等特殊字符
Oracle输入特殊字符的特殊方法: UPDATE BOOKMARK SET BM_VALUE=q'/ --在这里写下需要输入的内容(可以包括引号.回车等特殊的符号),所见即所得 /' -- WHER ...
- tomcat管理员在远程(不同)机器上访问管理页面
tomcat8.5管理员默认只能在安装tomcat的机器上访问,如果想在其他机器上访问,则需要进行配置修改 添加用户和权限(<tomcat>\conf\tomcat-users.xml): ...
- 【Ubuntu】Ubuntu bug “Reached target Shutdown”
在使用 Ubuntu-16.04.3-server-amd64.iso 版本(参考官方,iso下载地址)的时候,遇到一个Ubuntu的Bug,后来查了一下,在官方看到,目前还是Unassigned: ...
- 微软BI 之SSAS 系列 - 关于父子维度的设计
除了之前的几篇文章中出现的时间维度,雪花型维度的设计之外还有一种比较特殊的维度 - 父子维度.父子维度特殊就特殊在它包含了一种基于递归关系(Recursive Relationship)的引用结构, ...
- MAC LINUX 安装PYQT(事例)
MAC安装 1.安装命令:brew install pyqt Warning: Your Xcode () is outdated Please install Xcode 5.0. Warning: ...
- Statement、PreparedStatemnt、CallableStatement
第一.Statement(Statement代表一个特定的容器,来对一个特定的数据库执行语句) * 执行查询的方法 Statement=Connection.createStatement();//创 ...