DB2 10.5 for Linux, UNIX, and Windows

SET SESSION AUTHORIZATION statement

The SET SESSION AUTHORIZATION statement changes the value of the SESSION_USER special register.

The statement is not under transaction control. The SET SESSION AUTHORIZATION statement is intended to provide support for a single user assuming different authorization IDs on the same connection, and should not be used for scenarios in which different users reuse the same connection, commonly referred to as connection pooling.

Invocation

The statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.

Authorization

The privileges held by the authorization ID of the statement must include SETSESSIONUSER on the authorization ID value to which the special register is being set.

Syntax

Read syntax diagramSkip visual syntax diagram
                                   .-=-.   
>>-SET--+-SESSION AUTHORIZATION-+--+---+------------------------>
        '-SESSION_USER----------'          

>--+-authorization-name-+--+----------------------+------------><
   +-USER---------------+  '-ALLOW ADMINISTRATION-'   
   +-CURRENT_USER-------+                             
   +-SYSTEM_USER--------+                             
   +-host-variable------+                             
   '-string-constant----'                             

Description

authorization-name
Specifies the authorization ID that is to be used as the new value for the SESSION_USER special register.
USER
The value in the USER special register.
CURRENT_USER
The value in the CURRENT USER special register.
SYSTEM_USER
The value in the SYSTEM_USER special register.
host-variable
A variable of type CHAR or VARCHAR. The length of the contents of host-variable must not exceed 128 bytes (SQLSTATE 28000). It cannot be set to null. If host-variable has an associated indicator variable, the value of that indicator variable must not indicate a null value (SQLSTATE 28000).

The characters of host-variable must be left-aligned. When specifying authorization-name with a host variable, all characters must be specified in uppercase, because there is no conversion to uppercase characters.

string-constant
A character string constant with a maximum length of 128 bytes.
ALLOW ADMINISTRATION
Specifies that SQL schema statements can be specified before this statement in the same unit of work.

Rules

Notes

Examples