How to set the NLS_LANG parameter of the Oracle client

Source: Internet
Author: User

We know that,Oracle clientYou can useNLS_LANG ParameterThe setting of the NLS_LANG parameter varies on different system platforms. This article first introduces the composition of the NLS_LANG parameter, and then introduces the settings of the NLS_LANG parameter of the Oracle client on Windows and Unix platforms. Now we will introduce this part.

1. Composition of the NLS_LANG Parameter

The NLS_LANG parameter consists of the following parts: NLS_LANG = <Language >_< Territory>. <Clients Characterset>. The local meanings of NLS_LANG are as follows:

LANGUAGE:

  • Oracle message language
  • Revealing the month and day in a date

TERRITORY:

  • Currency and digital Style
  • Region and computing week-date adaptation

CHARACTERSET: the character set used by the client.

View the current system code page on Windows. The chcp call is E:/> chcp. The code page of the action is 936. The code page 936 is even the Chinese Character Set GBK.

2. Check the measures of NLS_LANG.

Windows uses echo % NLS_LANG %, for example:

 
 
  1. E:/>echo %NLS_LANG%  
  2.  
  3. AMERICAN_AMERICA.ZHS16GBK 

Unix uses env | grep NLS_LANG, for example:

 
 
  1. /Opt/oracle> Amazon e-paper book env | grep NLS_LANG
  2.  
  3. NLS_LANG = AMERICAN_CHINA.ZHS16GBK

In Windows client settings, you can modify NLS_LANG in the registration form. The detailed key value is HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/HOMExx/. xx indicates the system number when multiple ORACLE_HOME exists.

3. view the current character set parameter settings of the database

 
 
  1. SELECT * FROM v$nls_parameters; 

Or

 
 
  1. select * from nls_database_parameters 

Or

 
 
  1. select userenv(‘language’) from dual; 

4. view available Character Set parameter settings in the database

 
 
  1. SELECT * FROM v$nls_valid_values; 

5. setting measures for the client NLS_LANG

Windows:

 
 
  1. # Common Chinese character sets
  2.  
  3. Set NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK
  4.  
  5. # Common unicode character sets
  6.  
  7. Set NLS_LANG = american_america.AL32UTF8

You can always set the key value of the traversal correction Registration Form: HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/HOMExx/NLS_LANG.

Unix:

 
 
  1. # Common unicode character sets
  2.  
  3. Export NLS_LANG = american_america.AL32UTF8
  4.  
  5. # Common Chinese character sets
  6.  
  7. Export NLS_LANG = "Simplified Chinese_china". ZHS16GBK

You can edit the bash_profile file for permanent settings:

 
 
  1. Vi. bash_profile
  2.  
  3. NLS_LANG = "Simplified Chinese_china". ZHS16GBK export NLS_LANG
  4.  
  5. # Make the bash_profile settings take effect
  6.  
  7. Source. bash_profile

This article describes how to set the NLS_LANG parameter of the Oracle client.

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.