Change the oracle database SESSIONTIMEZONE using alter session


In this oracle tutorial we will learn how to change the database SESSIONTIMEZONE using alter session command in Oracle PL/SQL.

We can Change the database SESSIONTIMEZONE using alter session command in Oracle PL/SQL. It will temporarily change your database TIME ZONE/local session time zone  i.e. for current session only in Oracle PL/SQL.


Let’s change TIME ZONE to  [GMT  /  UTC+00:00]

ALTER session SET TIME_ZONE='+00:00';
Or,
ALTER session SET TIME_ZONE='GMT';


How to find my current database TIME ZONE in oracle PL/SQL?
Use either of the following
select CURRENT_TIMESTAMP from dual;

select SYSTIMESTAMP from dual;


Or, simple way is to use

SELECT SESSIONTIMEZONE FROM dual;

select results may be different depending upon TIME_ZONE, before execution of all the above select commands my TIME ZONE was ASIA/CALCUTTA  i.e. UTC+05:30


So in this oracle tutorial we learned how to change the database SESSIONTIMEZONE using alter session command in Oracle PL/SQL.

Labels: Oracle
eEdit
Must read for you :