Oracle SYSTIMESTAMP Function

Oracle SYSTIMESTAMP is a built-in function that returns the current date and time, including fractional seconds and time zone, as set by the operating system on the database server.

Oracle SYSTIMESTAMP Syntax

Here is the syntax for the Oracle SYSTIMESTAMP function:

SYSTIMESTAMP

Note that you cannot use parentheses after the function name.

Parameters

The Oracle SYSTIMESTAMP function does not require any parameters.

Return Value

The Oracle SYSTIMESTAMP function returns the current date and time, including fractional seconds and time zone, as set by the operating system on the database server.

Oracle SYSTIMESTAMP Examples

Here are a few examples demonstrating the use of the Oracle SYSTIMESTAMP function.

Basic Usage

To retrieve the current date and time, use the following statement:

ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SSXFF TZR';
SELECT
    SYSTIMESTAMP
FROM dual;

Output:

SYSTIMESTAMP
_______________________________________
2023-02-11 14:44:53.285000000 +08:00

Here, we use the ALTER SESSION statement to modify the date display format for the current session.

Formatting

You can use the TO_CHAR() function to format the output of SYSTIMESTAMP:

SELECT
    TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS')
      "TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS')"
FROM dual;

Output:

TO_CHAR(SYSTIMESTAMP, 'YYYY-MM-DD HH24:MI:SS')
_________________________________________________
2023-02-11 14:49:13

Conclusion

Oracle SYSTIMESTAMP is a built-in function that returns the current date and time, including fractional seconds and time zone, as set by the operating system on the database server.