nls参数、环境变量以及函数等起作用的顺序!

nls参数、环境变量以及函数起作用的顺序是:

instance级参数--->nls_lang--->session级参数--->函数。

[@more@]

C:>set nls_lang=SIMPLIFIED CHINESE_CHINA.ZHS16GBK

C:>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 7月 29 21:01:38 2009

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> show parameter nls_date_format

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_date_format string yyyy/mm/dd hh24:mi:ss
--很明显实例级别参数nls_date_format没有启作用
SQL> select sysdate from dual;

SYSDATE
--------------
29-7月 -09
--==============================
--在注册表中清除nls_lang的值,这是我们发现实例级参数nls_date_format:格式
yyyy/mm/dd hh24:mi:ss开始发挥作用
SQL> exit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开

C:>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jul 29 20:54:59 2009

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


???:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select sysdate from dual;

SYSDATE
-------------------
2009/07/29 20:55:01
--====================================
--恢复注册表中的nls_lang设置:SIMPLIFIED CHINESE_CHINA.ZHS16GBK
SQL> exit
? Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options ??

C:>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 7月 29 20:55:21 2009

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select sysdate from dual;

SYSDATE
--------------
29-7月 -09

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

会话已更改。
--显然session级别的nls_date_format发挥了作用
SQL> select sysdate from dual;

SYSDATE
-------------------
2009-07-29 20:55:55
--很显然函数发挥了作用
SQL> select to_char(sysdate,'yyyy-mm-dd hh:mi:ss') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2009-07-29 09:10:01

SQL>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用中提到了新建环境变量NLS_LANG,并设置为SIMPLIFIED CHINESE_CHINA.ZHS16GBK。引用中提到了通过命令行(cmd)设置NLS_LANG环境变量为Simplified Chinese_China.AL32UTF8。根据这两个引用内容可以得出结论,环境变量NLS_LANG用于设置系统的字符集编码。具体来说,NLS_LANG是Oracle数据库中的一个环境变量,用于指定数据库会话的字符集和国家语言。在不同的操作系统中,设置NLS_LANG的方法可能有所不同。在Windows操作系统中,可以通过新建环境变量或者使用命令行工具来设置NLS_LANG。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Oracle入门精读29-Oracle客户端字符集与NLS_LANG环境变量](https://blog.csdn.net/msh2016/article/details/86766962)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [NLS_LANG修改环境变量工具](https://download.csdn.net/download/qq_34590413/10161600)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值