CURRENT DATE special register

The CURRENT DATE special register specifies a date that is based on a reading of the time-of-day clock when the SQL statement is executed at the current server.

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

The value of CURRENT DATE in a user-defined function or stored procedure is inherited according to the rules in Table 1. For other applications, the date is derived by the Db2 that executes the SQL statement that refers to the special register. For a description of how the date is derived, see Datetime special registers.

Specifying CURRENT_DATE is equivalent to specifying CURRENT DATE.

Example

Display the average age of employees.
  SELECT AVG(YEAR(CURRENT DATE - BIRTHDATE))
    FROM DSN8C10.EMP;
1 Except for the case of a non-atomic multiple row INSERT or MERGE statement.