Oracle7 Server Reference Manual

Contents Index Home Previous Next

Specifying Language-Dependent Behavior for a Session

This section discusses the NLS parameters that specify language- dependent operation of applications.

NLS_LANG Environment Variable

The NLS_LANG environment variable has three components (language, territory, and charset) in the form:

NLS_LANG = language_territory.charset

Each component controls the operation of a subset of NLS features.

language Specifies conventions such as the language used for Oracle messages, day names, and month names. Each supported language has a unique name; for example, American, French, or German. The language argument specifies default values for the territory and character set arguments, so either (or both) territory or charset can be omitted. For a complete list of languages, see "Supported Languages" [*].
territory Specifies conventions such as the default date format and decimal character used for numbers. Each supported territory has a unique name; for example, America, France, or Canada. For a complete list of territories, see "Supported Territories" [*].
charset Specifies the character set used by the client application (normally that of the user's terminal). Each supported character set has a unique acronym, for example, US7ASCII, WEISO8859P1, WE8DEC, WE8EBCDIC500, or JA16EUC. Each language has a default character set associated with it. Default values for the languages available on your system are listed in your installation or user's guide. For a complete list of character sets, see "Storage Character Sets" [*] and "Arabic/Hebrew Display Character Sets" [*].
Note: All components of the NLS_LANG definition are optional; any item left out will default. If you specify territory or charset, you must include the preceding delimiter [underscore ( _ ) for territory, period ( . ) for charset], otherwise the value will be parsed as a language name.

The three arguments of NLS_LANG can be specified in any combination, as in the following examples:

NLS_LANG = AMERICAN_AMERICA.US7ASCII

or

NLS_LANG = FRENCH_FRANCE.ISO8859P1

or

NLS_LANG = FRENCH_CANADA.WE8DEC

or

NLS_LANG = JAPANESE_JAPAN.JA16EUC

Specifying NLS_LANG

NLS_LANG is defined for each session by means of an environment variable or equivalent platform-specific mechanism. Different sessions connected to the same database can specify different values for NLS_LANG.

For example, on VMS you could specify the value of NLS_LANG by entering the following line at the VMS prompt:

$ DEFINE NLS_LANG FRENCH_FRANCE.WE8DEC

If you do not specify a value for NLS_LANG, the language_dependent behavior defaults to the language specified by the NLS_LANGUAGE database initialization parameter, the territory specified by the NLS-TERRITORY database initialization parameter, and the character set with which the database was created.

For more information on how to set NLS_LANG on your system, see your operating system-specific Oracle documentation.

Client/Server Architecture

NLS_LANG sets the NLS environment used by the database for both the Server session and for the client application. Using the one parameter ensures that the language environments of both database and client application are automatically the same.

Because NLS_LANG is an environment variable, it is read by the client application at startup time. The client communicates the information defined in NLS_LANG to the server when it connects.

Overriding Language and Territory Specifications

The default values for language and territory can be overridden for a session by using the ALTER SESSION statement. For example:

ALTER SESSION SET NLS_LANGUAGE = FRENCH NLS_TERRITORY = FRANCE

This feature implicitly determines the language environment of the database for each session. An ALTER SESSION statement is automatically executed when a session connects to a database to set the values of the database parameters NLS_LANGUAGE and NLS_TERRITORY to those specified by the language and territory arguments of NLS_LANG. If NLS_LANG is not defined, no ALTER SESSION statement is executed.

When NLS_LANG is defined, the implicit ALTER SESSION is executed for all instances to which the session connects, for both direct and indirect connections. If the values of NLS parameters are changed explicitly with ALTER SESSION during a session, the changes are propagated to all instances to which that user session is connected.


Contents Index Home Previous Next