Oracle environment variable Nls_lang

Source: Internet
Author: User
Tags reserved sqlplus

Nls_lang is an environment variable that defines language, geography, and character set properties. For non-English character sets, the Nls_lang setting is very important.

NLS: ' National Language Support (NLS) ' When we set up a nls we were actually specifying some of the expressions specific to his language when Oracle was storing the data, such as when we chose Chinese, and how its Chinese characters were stored , what rules are sorted, how the currency is represented, and the date format is set. The Nls_lang parameter consists of the following parts: nls_lang=<language>_<territory>.<clients characterset>
NLS_LANGUAGE Specifies:
-The language of the Oracle (error) Information
-Name of day and month
Note: Nls_language is not related to inserting and querying the language of the * data *.

NLS_TERRITORY Specifies:
-Currency and number formats
-Calculate the range and practice of weeks and days

Client Character set (clients CHARACTERSET):
-Define the Oracle client, the encoding used by the customer application
* or it will conform to your Microsoft Windows code page (GUI tools ACP, command prompt chcp value)
* or set to Utf8/al32utf8 for the Unicode WIN32 app. Common values can be found in Oracle Database Client Globalization Support setting up Nls_lang in Windows 1. Set the environment variable in the command promptIf you set Nls_lang as an environment variable on the command line, it overrides the definition of Nls_lang in the registry and System properties. At the command prompt, use the "set" command, for example: When language is set to Chinese, the prompt is as follows:c:\users\tianpan> set nls_lang=simplified Chinese_china. ZHS16GBKC:\users\tianpan>sqlplus/nolog

Sql*plus:release 11.2.0.1.0 Production on Friday November 28 10:07:21 2014

Copyright (c) 1982, Oracle. All rights reserved.

Sql> Conn Scott/tiger
is connected. Sql> select Sysdate from dual;

Sysdate
--------------
2 August-November-14 when language is set to American, the message is changed to English:c:\users\tianpan> set Nls_lang=american_america. ZHS16GBKC:\users\tianpan>sqlplus/nolog

Sql*plus:release 11.2.0.1.0 Production on Fri Nov 28 10:07:51 2014

Copyright (c) 1982, Oracle. All rights reserved.

Sql> Conn Scott/tiger
Connected.
Sql> select Sysdate from dual;

Sysdate
------------
28-NOV-14 is set under Windows via set Nls_lang, only session level, after closing the cmd window and then opening, it becomes the original setting. You can modify the parameters of the registry if it is to be permanently active. 2. Registry settings (permanent)By default, the Oracle installation on Windows uses the registry to define this setting.
Version 10g and above:
hkey_local_machine\software\oracle\key_<oracle_home_name>
Here you will see an entry named Nls_lang
Installing 32-bit software on a 64-bit Windows platform using a 32-bit compatibility path
hkey_local_machine\software\wow6432node\oracle\key_<oracle_home_name> 3. Operating system Environment VariablesAlthough the registry is the primary storage location for Microsoft Windows settings, it is not the only place where parameters can be set. Although not recommended, you can set Nls_lang as a system or user variable in the system properties. This setting will be used by all Oracle home. Set location: ' My Computer ', ' Properties ' > ' Advanced ' Environment variables because these environment variables are higher than the parameter levels already set in the registry, do not set the Oracle parameters in this location unless you have a good reason to do so. Settings under Linux/unix export Nls_lang=american_america. ZHS16GBK Export nls_lang=simplified Chinese_china. ZHS16GBK   Nls_lang in DB
DB also has its own Nls_lang parameter, which identifies the language, geography, and character set of the database. Can be found through the following SQL,
SELECT * from V$nls_parameters;
OR
SELECT USERENV (' language ') from DUAL;

Nls_lang and DB Nls_lang of the client
The Nls_lang of the DB and the client environment variables are nls_lang as consistent as possible. Setting the Nls_lang environment Variable for Oracle Databases provides a way to maintain consistency.
So why keep it consistent? That is because if the character set does not match, it is possible that a character conversion error occurs during the conversion between the DB and the client. Example of Oracle Nls_lang tips cited.


For more detailed information, refer to these materials below:The correct settings for Nls_lang in the Microsoft Windows environment (DOC ID 1577370.1) are set correctly in the Unix environment Nls_lang (DOC ID 1548858.1) Nls_lang explained (How Doe s client-server Character Conversion work?) (Doc ID 158577.1)

Nls_lang FAQ

Oracle Database Client Globalization Support
Setting the Nls_lang environment Variable for Oracle Databases

Oracle Nls_lang Tips

Reprint Please specify source: http://blog.csdn.net/pan_tian/article/details/7745717

======eof======

Oracle environment variable Nls_lang

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.