IBM Support

CURRENT_USER usage considerations

Question & Answer


Question

CURRENT_USER usage considerations

Answer

With IBM i 7.2, DB2 for i added CURRENT_USER to its list of supported special registers.
Table 1 shows a simple description of the different special registers that can be used to extract user identity information within SQL. The SQL Reference includes more details on special registers and CURRENT_USER.



When special registers are referenced within global variable default values, users should understand that global variables are typically instantiated a single time within a job (or session). That means that if you reference identity information within the global variable default value, the identity in place within the job on the first reference will apply. Subsequent references to the global variable will not cause the default expression to be re-evaluated.

Additionally, since CURRENT_USER provides some insight into the adopted authority in effect, users should also be aware that global variables default values exist within a *SRVPGM executable object that is built to use adopted authority when the default expression is evaluated. Therefore, global variable default values would always return the authorization ID of the owner of the global variable as the CURRENT_USER.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]

Document Information

Modified date:
18 December 2019

UID

nas8N1020203