Hitachi

Hitachi Advanced Database SQL Reference


6.4.3 CURRENT_TIMESTAMP

Returns the current time stamp (date and time).

Organization of this subsection

(1) Specification format

datetime-information-acquisition-function-CURRENT_TIMESTAMP ::= CURRENT_TIMESTAMP[(p)]

(2) Rules

  1. The fractional seconds precision (the number of digits to the right of the decimal point) is specified in p. You can specify the value 0, 3, 6, 9, or 12 for p. For example, when p is 3, there will be 3 digits in the fractional seconds of the execution result of CURRENT_TIMESTAMP.

  2. When (p) is omitted, p = 0 is assumed.

  3. The data type of the execution result is the TIMESTAMP type.

  4. Specifying CURRENT_TIMESTAMP multiple times in an SQL statement produces the same date and time values.

  5. The value of CURRENT_TIMESTAMP 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.

  6. The precision of the fractional seconds acquired by CURRENT_TIMESTAMP depends on the capabilities of the hardware. For example, if you specify CURRENT_TIMESTAMP(12), depending on the hardware you are using you might not be able to acquire 12 digits of fractional seconds precision.

    Example:

    2014-09-25 10:35:55.123456000000

    As shown above, if only 6 digits of fractional seconds precision can be acquired, the 7th and subsequent digits will be 0.

  7. CURRENT_TIMESTAMP can be specified in places where a value specification can be specified.

(3) Example

Example

Add new customer information to the customer table (USERSLIST). The column structure of the customer table is as follows.

  • Customer ID (USERID)

  • Name (NAME)

  • Sex (SEX)

  • Datetime (LAST_UPDATE_TIME) when the customer information was last updated

  INSERT INTO "USERSLIST"
        ("USERID","NAME","SEX","LAST_UPDATE_TIME")
      VALUES
        ('U00887','Edward Connelly','M',CURRENT_TIMESTAMP)