You can specify certain special registers in SQL statements.
For locally run SQL statements, the special registers and their contents are shown in the following table:
Special registers | Contents |
---|---|
CURRENT DATE |
The current date. |
CURRENT DEGREE |
The number of tasks the data base manager should run in parallel. |
CURRENT PATH |
The SQL path used to resolve unqualified data type names, procedure names, and function names in dynamically prepared SQL statements. |
CURRENT SCHEMA |
The schema name used to qualify unqualified database object references where applicable in dynamically prepared SQL statements. |
CURRENT SERVER |
The name of the relational database currently being used. |
CURRENT TIME |
The current time. |
CURRENT TIMESTAMP |
The current date and time in timestamp format. |
CURRENT TIMEZONE |
A duration of time that links local time
to Universal Time Coordinated (UTC) using the formula: local time - CURRENT TIMEZONE = UTCIt is taken from the system value QUTCOFFSET. |
SESSION_USER |
The runtime authorization identifier (user profile) of the job. |
SYSTEM_USER |
The authorization identifier (user profile) of the user connected to the database. |
If a single statement contains more than one reference to any of CURRENT DATE, CURRENT TIME, or CURRENT TIMESTAMP special registers, or the CURDATE, CURTIME, or NOW scalar functions, all values are based on a single clock reading.
For remotely run SQL statements, the special registers and their contents are shown in the following table:
Special registers | Contents |
---|---|
CURRENT DATE |
The current date and time at the remote system, not the local system. |
CURRENT DEGREE |
The number of tasks the data base manager should run in parallel on the remote system. |
CURRENT TIMEZONE |
A duration of time that links the remote system time to UTC. |
CURRENT SERVER |
The name of the relational database currently being used. |
CURRENT SCHEMA | The current schema value at the remote system. |
CURRENT PATH |
The current path value at the remote system. |
SESSION_USER |
The runtime authorization identifier (user profile) of the job on the remote system. |
SYSTEM_USER |
The authorization identifier (user profile) of the user connected to the database on the remote system. |
When a query over a distributed table references a special register, the contents of the special register on the system that requests the query are used. For more information about distributed tables, see DB2® Multisystem topic collection.