Special registers in SQL statements

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
CURRENT_DATE

The current date.
Start of change

CURRENT DEGREE

End of change
Start of changeThe number of tasks the data base manager should run in parallel.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.
Start of change

SESSION_USER
USER

End of change
Start of changeThe runtime authorization identifier (user profile) of the job.End of change
Start of change

SYSTEM_USER

End of change
Start of changeThe authorization identifier (user profile) of the user connected to the database.End of change

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
CURRENT_DATE
CURRENT TIME
CURRENT_TIME
CURRENT TIMESTAMP
CURRENT_TIMESTAMP

The current date and time at the remote system, not the local system.
Start of change

CURRENT DEGREE

End of change
Start of changeThe number of tasks the data base manager should run in parallel on the remote system. End of change

CURRENT TIMEZONE
CURRENT_TIMEZONE

A duration of time that links the remote system time to UTC.

CURRENT SERVER
CURRENT_SERVER

The name of the relational database currently being used.
CURRENT SCHEMA The current schema value at the remote system.

CURRENT PATH
CURRENT_PATH
CURRENT FUNCTION PATH

The current path value at the remote system.
Start of change

SESSION_USER
USER

End of change
The runtime authorization identifier (user profile) of the job on the remote system.
Start of change

SYSTEM_USER

End of change
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.