CURRENT_TIMESTAMP/CURRENT_TIMESTAMP()/SYS_TIMESTAMP/SYSTIMESTAMP/LOCALTIME/LOCATIME()/LOCALTIMESTAMP/LOCALTIMESTAMP()

Description

The CURRENT_TIMESTAMP, CURRENT_TIMESTAMP(), SYS_TIMESTAMP, SYSTIMESTAMP, LOCALTIME, LOCALTIME(), LOCALTIMESTAMP, and LOCALTIMESTAMP() are used interchangeably, and they return the current date and time as TIMESTAMP type. The unit is second.

If you define DEFAULT value for column initial value and specify the initial value to SYS_DATETIME, the default value is specified to the timestamp at the time of creating a table, not inserting a table. Note that the default value is not specified in case of INSERT. Therefore, you must specify SYS_DATETIME in the VALUES of INSERT statement upon inserting data.

Syntax

CURRENT_TIMESTAMP

CURRENT_TIMESTAMP()

SYS_TIMESTAMP

SYSTIMESTAMP

LOCALTIME

LOCALTIME()

LOCALTIMESTAMP

LOCALTIMESTAMP()

Example

--it returns the current date and time in TIMESTAMP type

SELECT LOCALTIME, SYS_TIMESTAMP;

 SYS_TIMESTAMP              SYS_TIMESTAMP

==============================================================================

  07:00:48 PM 04/01/2010     07:00:48 PM 04/01/2010

 

--it returns the timestamp value 1 hour added to the current sys_timestamp value

SELECT CURRENT_TIMESTAMP()+3600;

 SYS_TIMESTAMP +3600

===========================

  08:02:42 PM 04/01/2010