DB2 Version 10.1 for Linux, UNIX, and Windows

SESSION_USER special register

The SESSION_USER special register specifies the current runtime authorization ID that is being used for the current session.

The data type of the register is VARCHAR(128). If the length of the authorization ID is less than 8 bytes, the special register value is padded with trailing blanks such that the length is 8 bytes.

The initial value of SESSION_USER for a new connection is the same as the value of the SYSTEM_USER special register. Its value can be changed by invoking the SET SESSION AUTHORIZATION statement.

SESSION_USER is a synonym for the USER special register.

Example: Determine what routines can be executed by current runtime authorization ID if it were to issue invocations through dynamic SQL.
   SELECT SCHEMA, SPECIFICNAME FROM SYSCAT.ROUTINEAUTH
     WHERE GRANTEE = SESSION_USER
     AND EXECUTEAUTH IN ('Y', 'G')