Special registers in SQL statements

You can specify certain special registers in SQL statements. A special register, for example, CURRENT DATE, contains information that can be referenced in SQL statements.

For locally run SQL statements, the special registers and their contents are shown in the following table.

Special registers Contents

CURRENT CLIENT_ACCTNG
CLIENT ACCTNG

The accounting string for the client connection.

CURRENT CLIENT_APPLNAME
CLIENT APPLNAME

The application name for the client connection.

CURRENT CLIENT_PROGRAMID
CLIENT PROGRAMID

The program ID for the client connection.

CURRENT CLIENT_USERID
CLIENT USERID

The client user ID for the client connection.

CURRENT CLIENT_WRKSTNNAME
CLIENT WRKSTNNAME

The workstation name for the client connection.

CURRENT DATE
CURRENT_DATE

The current date.

CURRENT DEBUG MODE

The debug mode to be used when creating or altering routines.

CURRENT DECFLOAT ROUNDING MODE

The rounding mode to be used when working with decimal floating point values.

CURRENT DEGREE

The number of tasks the database manager should run in parallel.
Start of change

CURRENT IMPLICIT XMLPARSE OPTION

End of change
Start of changeThe whitespace handling options to be used for XML data when implicitly parsed without validation.End of change

CURRENT PATH
CURRENT_PATH
CURRENT FUNCTION 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
CURRENT_SERVER

The name of the relational database currently being used.

CURRENT TIME
CURRENT_TIME

The current time.

CURRENT TIMESTAMP
CURRENT_TIMESTAMP

The current date and time in timestamp format.

CURRENT TIMEZONE
CURRENT_TIMEZONE

A duration of time that links local time to Universal Time Coordinated (UTC) using the formula:
local time - 
CURRENT TIMEZONE = UTC
It is taken from the system value QUTCOFFSET.

SESSION_USER
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 values for special registers are determined at 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 the DB2® Multisystem topic collection.