Setting NLS Parameters

本文介绍了如何在客户端和服务端通过初始化参数、环境变量、ALTER SESSION语句及SQL函数等方式设置NLS参数来控制区域特定行为,并提供了不同设置方法的优先级说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Setting NLS Parameters

NLS (National Language Support) parameters determine the locale-specific behavior on both the client and the server. NLS parameters can be specified in the following ways:

  • As initialization parameters on the server

    You can include parameters in the initialization parameter file to specify a default session NLS environment. These settings have no effect on the client side; they control only the server's behavior. For example:

    NLS_TERRITORY = "CZECH REPUBLIC"
    
    
  • As environment variables on the client

    You can use NLS environment variables, which may be platform-dependent, to specify locale-dependent behavior for the client and also to override the default values set for the session in the initialization parameter file. For example, on a UNIX system:

    % setenv NLS_SORT FRENCH
    
    
  • With the ALTER SESSION statement

    You can use NLS parameters that are set in an ALTER SESSION statement to override the default values that are set for the session in the initialization parameter file or set by the client with environment variables.

    ALTER SESSION SET NLS_SORT = FRENCH;
    

    See Also:

    Oracle Database SQL Reference for more information about the  ALTER  SESSION statement
  • In SQL functions

    You can use NLS parameters explicitly to hardcode NLS behavior within a SQL function. This practice overrides the default values that are set for the session in the initialization parameter file, set for the client with environment variables, or set for the session by the ALTER SESSION statement. For example:

    TO_CHAR(hiredate, 'DD/MON/YYYY', 'nls_date_language = FRENCH')
    

    See Also:

    Oracle Database SQL Reference for more information about SQL functions, including the  TO_CHAR function

Table 3-1 shows the precedence order of the different methods of setting NLS parameters. Higher priority settings override lower priority settings. For example, a default value has the lowest priority and can be overridden by any other method.

Table 3-1 Methods of Setting NLS Parameters and Their Priorities

Priority Method

1 (highest)

Explicitly set in SQL functions

2

Set by an ALTER SESSION statement

3

Set as an environment variable

4

Specified in the initialization parameter file

5

Default


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值