TIMESTAMP

The TIMESTAMP function returns a timestamp from a value or a pair of values.

The rules for the arguments depend on whether the second argument is specified:
  • If only one argument is specified: It must be a timestamp, a valid string representation of a timestamp, or a string of length 14 that is not a CLOB, LONG VARCHAR, or XML value. A string of length 14 must be a string of digits that represents a valid date and time in the form yyyyxxddhhmmss, where yyyy is the year, xx is the month, dd is the day, hh is the hour, mm is the minute, and ss is the seconds.
  • If both arguments are specified: The first argument must be a date or a valid string representation of a date and the second argument must be a time or a valid string representation of a time.
The other rules depend on whether the second argument is specified:
  • If both arguments are specified: The result is a timestamp with the date specified by the first argument and the time specified by the second argument. The microsecond part of the timestamp is zero.
  • If only one argument is specified and it is a timestamp: The result is that timestamp.
  • If only one argument is specified and it is a string: The result is the timestamp represented by that string. If the argument is a string of length 14, the timestamp has a microsecond part of zero.

Syntax

TIMESTAMP ( expression [, expression ] )

Examples

The second column in table records_table contains dates (such as 1998-12-25) and the third column contains times of day (such as 17:12:30). You can return the timestamp with this statement:
SELECT TIMESTAMP(col2, col3) FROM records_table
The following clause returns the value 1998-12-25-17:12:30.0:
VALUES TIMESTAMP('1998-12-25', '17.12.30'); 
1 
-------------------------- 
1998-12-25 17:12:30.0