DB2 Version 10.1 for Linux, UNIX, and Windows

CURRENT TIME special register

The CURRENT TIME (or CURRENT_TIME) special register specifies a time that is based on a reading of the time-of-day clock when the SQL statement is executed at the application server.

If this special register is used more than once within a single SQL statement, or used with CURRENT DATE or CURRENT TIMESTAMP within a single statement, all values are based on a single clock reading.

When used in an SQL statement inside a routine, CURRENT TIME is not inherited from the invoking statement.

In a federated system, CURRENT TIME can be used in a query intended for data sources. When the query is processed, the time returned will be obtained from the CURRENT TIME register at the federated server, not from the data sources.

Example: Run the following command from the DB2® CLP to obtain the current time.
    db2 values CURRENT TIME
Example: Using the CL_SCHED table, select all the classes (CLASS_CODE) that start (STARTING) later today. Today's classes have a value of 3 in the DAY column.
   SELECT CLASS_CODE FROM CL_SCHED
     WHERE STARTING > CURRENT TIME AND DAY = 3