TraceLife

真正的幸福,在于对平淡生活的热爱……

导航

NLS(National Language Support)

Posted on 2009-06-28 20:34  hallo  阅读(1977)  评论(0编辑  收藏  举报

    NLS - 区域语言支持,用来定义用户所在区域的日期格式,计数方法,货币单位以及语言设置等选项。就比如中国内地的区域设置,见下图。

MWSnap036 2009-06-28, 20_03_28

 

    NLS 技术的使用,可以把货币符号从 $ 转换为 ,语言从 英文 转成 中文。这样用户就可以使用母语来与 Oracle 进行交互,并且遵循用户的数据显示惯例。

    下面的 SQL 实例演示了 NLS 参数的功用。

● 客户端参数(Client Parameters)

    可以通过 ALTER SESSION 命令更改此参数   

SQL> SELECT * FROM nls_session_parameters;
 
PARAMETER                                      VALUE
---------------------------------------------- -----------------------------------
NLS_LANGUAGE                                   SIMPLIFIED CHINESE
NLS_TERRITORY                                  CHINA
NLS_CURRENCY                                   RMB
NLS_ISO_CURRENCY                               CHINA
NLS_NUMERIC_CHARACTERS                         .,
NLS_CALENDAR                                   GREGORIAN
NLS_DATE_FORMAT                                dd
-mon-yy
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                              RMB
NLS_COMP                                       
BINARY
NLS_LENGTH_SEMANTICS                           BYTE
NLS_NCHAR_CONV_EXCP                            FALSE
 
17 rows selected
 

● 实例参数(Instance Parameters)

    可以通过 ALTER SYSTEM 命令更改此参数 

SQL> SELECT * FROM nls_instance_parameters;
 
PARAMETER                                      VALUE
---------------------------------------------- ---------------
NLS_LANGUAGE                                   AMERICAN
NLS_TERRITORY                                  AMERICA
NLS_SORT                                       
NLS_DATE_LANGUAGE                              
NLS_DATE_FORMAT                                
NLS_CURRENCY                                   
NLS_NUMERIC_CHARACTERS                         
NLS_ISO_CURRENCY                               
NLS_CALENDAR                                   
NLS_TIME_FORMAT                                
NLS_TIMESTAMP_FORMAT                           
NLS_TIME_TZ_FORMAT                             
NLS_TIMESTAMP_TZ_FORMAT                        
NLS_DUAL_CURRENCY                              
NLS_COMP                                       
NLS_LENGTH_SEMANTICS                           BYTE
NLS_NCHAR_CONV_EXCP                            FALSE
 
17 rows selected

 ● 数据库参数(Database Parameters)

     在数据库的创建过程中进行设置。

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               ZHS16GBK
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              
10.2.0.1.0
 
20 rows selected

          

     Note:

      需要注意,三个参数具有优先级关系,其中 Session Parameters 的优先级

      最高,优先启用 Session 级别所设置的参数。

      SESSION > INSTANCE > DATABASE