CURRENT DATE special register
The CURRENT DATE (or 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 application server.
If this special register is used more than once 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.
When used in an SQL statement inside a routine, CURRENT DATE is not inherited from the invoking statement.
In a federated system, CURRENT DATE can be used in a query intended for data sources. When the query is processed, the date returned will be obtained from the CURRENT DATE register at the federated server, not from the data sources.
Examples
- Run the following
command from the Db2® CLP to obtain the
current date.
db2 values CURRENT DATE
- Using the PROJECT table, set the project end date (PRENDATE) of
the MA2111 project (PROJNO) to the current date.
UPDATE PROJECT SET PRENDATE = CURRENT DATE WHERE PROJNO = 'MA2111'