Setting NLS Parameters

来源:互联网 发布:井伊直弼 知乎 编辑:程序博客网 时间:2024/06/13 06:23

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

PriorityMethod

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


0 0