首页 > 其他 > 详细

NLS_LANG 设置

时间:2015-10-31 00:27:07      阅读:365      评论:0      收藏:0      [点我收藏+]
#
NLS_LANG 的构成为:NLS_LANG=<NLS_LANGUAGE>_<NLS_TERRITORY>.<clients characterset>

#
从 nls_database_parameters 获取 <NLS_LANGUAGE> 和 <NLS_TERRITORY> 的值

# linux 设置
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

# windows 设置
set NLS_LANG=American_America.AL32UTF8
实验
[oracle@localhost ~]$ sqlplus ‘/as sysdba‘

SQL*Plus: Release 11.2.0.4.0 Production on Fri Oct 30 08:15:23 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> drop table t3;

Table dropped.

SQL> 
SQL> create table t3 ( a char ( 4 char));

Table created.

SQL> insert into t3 values(‘中国航天‘);
insert into t3 values(‘中国航天‘)
                      *
ERROR at line 1:
ORA-12899: value too large for column "SYS"."T3"."A" (actual: 12, maximum: 4)


SQL> set lin 80 pages 200
SQL> col parameter for a35
SQL> col value for a35
SQL> select * from nls_database_parameters;

PARAMETER                           VALUE
----------------------------------- -----------------------------------
NLS_LANGUAGE                        AMERICAN
NLS_TERRITORY                       AMERICA
NLS_CURRENCY                        $
NLS_ISO_CURRENCY                    AMERICA
NLS_NUMERIC_CHARACTERS              .,
NLS_CHARACTERSET                    AL32UTF8
NLS_CALENDAR                        GREGORIAN
NLS_DATE_FORMAT                     DD-MON-RR
NLS_DATE_LANGUAGE                   AMERICAN
NLS_SORT                            BINARY
NLS_TIME_FORMAT                     HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT                DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT                  HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT             DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY                   $
NLS_COMP                            BINARY
NLS_LENGTH_SEMANTICS                BYTE
NLS_NCHAR_CONV_EXCP                 FALSE
NLS_NCHAR_CHARACTERSET              AL16UTF16
NLS_RDBMS_VERSION                   11.2.0.4.0

20 rows selected.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost ~]$ 
[oracle@localhost ~]$ export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
[oracle@localhost ~]$ sqlplus ‘/as sysdba‘

SQL*Plus: Release 11.2.0.4.0 Production on Fri Oct 30 08:20:26 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> insert into t3 values(‘中国航天‘);

1 row created.

SQL> select * from t3;

A
----------------
中国航天

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost ~]$ 
[oracle@localhost ~]$ echo $NLS_LANG
AMERICAN_AMERICA.AL32UTF8
[oracle@localhost ~]$


NLS_LANG 设置

原文:http://my.oschina.net/payun/blog/524216

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!