Oracle SYSTIMESTAMP Function returns the current date and time along with fractional seconds and time zone as in the local database.
Oracle SYSTIMESTAMP Function Syntax
SELECT SYSTIMESTAMP FROM table_name;
Oracle SYSTIMESTAMP – Using SQL SELECT Statement Example
Oracle SYSTIMESTAMP is used with the SQL SELECT Statement.
For example, below SYSTIMESTAMP query returns current date/time with fractional seconds/time zone as per local database.
SELECT SYSTIMESTAMP FROM dual;
The above query may return the current date and time along with the fractional seconds and time zone from the local database e.g. “11/1/2012 4:51:35.428000 PM +05:30”.
The output may differ based on the local database time and time zone settings.
Oracle SYSTIMESTAMP – Using SQL TRUNC Function Example
Oracle SYSTIMESTAMP can be used with the SQL TRUNC Function to view the date component only.
For example, below Oracle SYSTIMESTAMP query returns current date as per local database.
SELECT TRUNC(SYSTIMESTAMP) FROM dual;
The above query may return the current date and time along with the fractional seconds and time zone from the local database e.g. “11/1/2012”.
The output may differ based on the local database date settings.
Oracle SYSTIMESTAMP – Using + and – Example
Oracle SYSTIMESTAMP can be used with the + and – signs to get forward and previous dates.
For example, below Oracle SYSTIMESTAMP query returns systimestamp if next day.
SELECT (SYSTIMESTAMP+1) FROM dual;
The above query may return the current date and time along with the fractional seconds and time zone from the local database e.g. “12/1/2012”.
The output may differ based on the local database date settings.