Oracle SESSIONTIMEZONE() Function

Oracle SESSIONTIMEZONE() is a built-in function that returns the value of the time zone for the current session.

Syntax of Oracle SESSIONTIMEZONE()

Here is the syntax for the Oracle SESSIONTIMEZONE() function:

SESSIONTIMEZONE(str)

Parameters

The Oracle SESSIONTIMEZONE() function does not require any parameters.

Return Value

The Oracle SESSIONTIMEZONE() function returns the value of the time zone for the current session. The return type is the time zone offset (in the format '[+|-]TZH:TZM') or the time zone region name, depending on how the user specified the database time zone value in the most recent CREATE DATABASE or ALTER DATABASE statement.

Examples of Oracle SESSIONTIMEZONE()

Here are some examples that demonstrate the usage of the Oracle SESSIONTIMEZONE() function.

Basic Usage

To retrieve the value of the time zone for the current session, use the following statement with SESSIONTIMEZONE:

SELECT
    SESSIONTIMEZONE
FROM dual;

Output:

SESSIONTIMEZONE
__________________
Asia/Shanghai

Database Time Zone

To retrieve the value of the time zone for the current session, use the following statement with DBTIMEZONE:

SELECT
    DBTIMEZONE
FROM dual;

Output:

DBTIMEZONE
_____________
+00:00

Conclusion

Oracle SESSIONTIMEZONE() is a built-in function that returns the value of the time zone for the current session.