Compare the role of LANG and NLS_LANG in Linux

  
                

LANG and NLS_LANG are the most common in setting Linux environment variables. What is the difference between LANG and NLS_LANG? Here's an example to give you a difference and compare them together.

LANG is set for language, region, character set of Linux systems, applications under linux effective, such as date; NLS_LANG is for Oracle language, region, set the character set of oracle Valid in

For example:

The code is as follows:

export LANG=zh_CN.GB2312

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

$export LANG=zh_CN.GB2312

$date

Tuesday, November 27th, 2012 16:20:35 CST

The display is in Chinese.

The code is as follows:

$export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

$sqlplus /as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Nov 27 16:19:03 2012

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

SQL select sysdate from Dual;

SYSDATE

------------

27-NOV-12

shows the English environment, But only for the ORACLE program.

The LANG system for environment variables has the following main items:

The code is as follows:

[root@blliu tmp]# locale

LANG =zh_CN.gb2312

LC_CTYPE=“zh_CN.gb2312”

LC_NUMERIC=“zh_CN.gb2312”

LC_TIME=“zh_CN.gb2312”

LC_COLLATE=“zh_CN.gb2312”

LC_MONETARY=“zh_CN.gb2312”

LC_MESSAGES=“zh_CN.gb2312”

LC_PAPER=“zh_CN. Gb2312”

LC_NAME=“zh_CN.gb2312”

LC_ADDRESS=“zh_CN.gb2312”

LC_TELEPHONE=“zh_CN.gb2312”

LC_MEASUREMENT=“zh_CN.gb2312”

LC_IDENTIFICATION=“zh_CN.gb2312”

LC_ALL=

LC_ALL is not set here, if it is set, all settings above If it is invalid, the system will read LC_ALL.

locale -a View local character set

locale -m View all supported character sets

Check NLS_LANG settings in Oracle database:

Code below :

SQL SELECT *

2 FROM DATABASE_PROPERTIES

3 WHERE PROPERTY_NAME IN

4 (‘NLS_LANGUAGE’, ‘NLS_TERRITORY’, ‘ NLS_CHARACTERSET’);

PROPERTY_NAME PROPERTY_VALUE DESCRIPTION

------------------------------ ----------------------------- --------------------< Br>

NLS_LANGUAGE AMERICAN Language

NLS_TERRITORY AMERICA Territory

The above is the difference between the Linux environment variables LANG and NLS_LANG. The LANG mainly affects the Linux system, and the NLS_LANG is valid for the oracle. For non-English character sets, the setting of NLS_LANG is very important.

Copyright © Windows knowledge All Rights Reserved