Modifies a runtime parameter.

Syntax

ALTER SESSION SET name = value

Description

You can use the ALTER SESSION command to modify a runtime parameter. ALTER SESSION only changes the value that is used by the current session. Certain parameters are provided only to be compatible with the Oracle syntax and have no impact on the running behavior of PolarDB for PostgreSQL(Compatible with Oracle). Other parameters change the runtime parameters of PolarDB for PostgreSQL(Compatible with Oracle).

Parameters

ParameterDescription
nameThe name of the runtime parameter. The following table lists available parameters.
valueThe new value of the parameter.

You can use the ALTERSESSION command to modify the following parameters:

ParameterDescription
NLS_DATE_FORMAT (string)The display format of the date and time values and the rules for interpreting ambiguous data input values. This parameter has the same effect as the datestyle parameter.
NLS_LANGUAGE (string)The language in which messages are displayed. This parameter has the same effect as the lc_messages parameter.
NLS_LENGTH_SEMANTICS (string)Valid values: BYTE and CHAR. Default value: BYTE. This parameter is provided only for syntax compatibility and has no effect in PolarDB for PostgreSQL(Compatible with Oracle).
OPTIMIZER_MODE (string)The default query optimization mode. Valid values: ALL_ROWS, CHOOSE, FIRST_ROWS, FIRST_ROWS_10, FIRST_ROWS_100, and FIRST_ROWS_1000. Default value: CHOOSE. This parameter is implemented in PolarDB for PostgreSQL(Compatible with Oracle).
QUERY_REWRITE_ENABLED (string)Valid values: TRUE, FALSE, and FORCE. Default value: FALSE. This parameter is provided only for syntax compatibility and has no effect in PolarDB for PostgreSQL(Compatible with Oracle).
QUERY_REWRITE_INTEGRITY (string)Valid values: ENFORCED, TRUSTED, and STALE_TOLERATED. Default value: ENFORCED. This parameter is provided only for syntax compatibility and has no effect in PolarDB for PostgreSQL(Compatible with Oracle).

Examples

Set the language to English (United States) in UTF-8-encoding. Note: In this example, the value en_US.UTF-8 must use the format that you specified for PolarDB for PostgreSQL(Compatible with Oracle). This format is not compatible with Oracle databases.

ALTER SESSION SET NLS_LANGUAGE = 'en_US.UTF-8';

Set the date display format:

ALTER SESSION SET NLS_DATE_FORMAT = 'dd/mm/yyyy';