SET CURRENT SQLID
The SET CURRENT SQLID statement assigns a value to the CURRENT SQLID special register.
Invocation
This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared. The value to which special register CURRENT SQLID is set is used as the SQL authorization ID for dynamic SQL statements only if DYNAMICRULES run behavior is in effect. The CURRENT SQLID value is ignored for the other DYNAMICRULES behaviors.
Authorization
CURRENT SQLID cannot be set to the name of a role.
Syntax
>>-SET CURRENT SQLID--=--+-+-SESSION_USER-+-+------------------>< | '-USER---------' | +-string-constant--+ '-host-variable----'
Description
The value of CURRENT SQLID is replaced by the value of SESSION_USER, string-constant, or host-variable. The value specified by a string-constant or host-variable must be a character string that contains 8 characters or less. Unless some authorization ID of the process has SYSADM authority, the value must be equal to one of the authorization IDs of the process.
Notes
Effect on authorization IDs: SET CURRENT SQLID does not change the primary authorization ID of the process.
If the SET CURRENT SQLID statement is executed in a stored procedure or user-defined function package that has a dynamic SQL behavior other than run behavior, the SET CURRENT SQLID statement does not affect the authorization ID that is used for dynamic SQL statements in the package. The dynamic SQL behavior determines the authorization ID. For more information, see DYNAMICRULES bind option.
Effect on special register CURRENT PATH: When the value of the PATH special register depends on the value of the CURRENT SQLID special register, any changes to the CURRENT SQLID special register are not reflected in the value of the PATH special register until a commit operation is performed or a SET PATH statement is issued to change the SQL path to use the new value of the CURRENT SQLID.
DRDA classification: SET CURRENT SQLID is executed by the database server and is therefore classified as a non-local SET statement in DRDA.
Examples
SET CURRENT SQLID = SESSION_USER;