Oracle CURRENT_TIMESTAMP Function is used to return the current date and time of the current SQL session. SQL CURRENT_TIMESTAMP returns the TIME STAMP with the TIME ZONE value.
Oracle CURRENT_TIMESTAMP Function Syntax
SELECT CURRENT_TIMESTAMP FROM table_name;
SQL CURRENT_TIMESTAMP Function returns the date and time as set by the SQL ALTER SESSION statement.
Oracle CURRENT_TIMESTAMP Function – Using SQL SELECT Statement Example
SQL CURRENT_TIMESTAMP Function is used with the SQL SELECT Statement.
For example, the SQL CURRENT_TIMESTAMP query below returns the current date/time with time zone of the current SQL session
SELECT CURRENT_TIMESTAMP FROM DUAL;
May return something like “11/5/2012 12:05:49.054000 PM +05:30” depending upon the value of the SQL Session date/time settings.
Oracle CURRENT_TIMESTAMP Function – Using ALTER SESSION Example
We can alter the session time of the SQL SESSION by using the SQL ALTER SESSION Statement.
For example, the below SQL query will alter the time zone of the SQL session to “-7:00”
ALTER SESSION SET TIME_ZONE = '-7:0';
Now, the below SQL CURRENT_TIMESTAMP query returns the altered time stamp.
SELECT CURRENT_TIMESTAMP FROM DUAL;
May return something like “11/4/2012 11:36:06.800000 PM -07:00” as the time zone has been altered.