Hitachi

Hitachi Advanced Database SQL Reference


6.4.1 CURRENT_DATE

Returns the current date.

Organization of this subsection

(1) Specification format

datetime-information-acquisition-function-CURRENT_DATE ::= CURRENT_DATE

(2) Rules

  1. The data type of the execution result is the DATE type.

  2. Specifying CURRENT_DATE multiple times in an SQL statement produces the same date value.

  3. The value of CURRENT_DATE is acquired when the SQL statement is executed on the HADB server. For details about interfaces and execution methods for executing SQL statements, see the descriptions of the JDBC API, ODBC functions, and CLI functions in the HADB Application Development Guide.

  4. CURRENT_DATE can be specified in places where a value specification can be specified.

(3) Examples

Example 1

Retrieve the customer ID (USERID) and product code (PUR-CODE) from the sales history table (SALESLIST) for customers who made purchases today.

SELECT "USERID","PUR-CODE"
    FROM "SALESLIST"
        WHERE "PUR-DATE"=CURRENT_DATE
Example 2

Insert the following data (row) into the sales history table (SALESLIST).

  • Customer ID (USERID): U00358

  • Product code (PUR-CODE): P003

  • Quantity purchased (PUR-NUM): 5

  • Date of purchase (PUR-DATE): Today's date

  INSERT INTO "SALESLIST"
        ("USERID","PUR-CODE","PUR-NUM","PUR-DATE")
      VALUES('U00358','P003',5,CURRENT_DATE)