Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / SQL PLUS Session Environment
 

Alter session to change the time zone

SQL>  create table myTable (   2  starts  timestamp with local time zone ); Table created. SQL> SQL> insert into myTable (starts)   2  values (TIMESTAMP '2001-12-01 15:00:00.000000 EST'); 1 row created. SQL> SQL> insert into myTable (starts)   2  values (TIMESTAMP '2001-12-01 17:00:00.000000 PST'); 1 row created. SQL> SQL> insert into myTable (starts)   2  values (TIMESTAMP '2001-12-01 20:00:00.000000 GMT'); 1 row created. SQL> SQL> alter session set time_zone = '-05:00'   2 SQL> column starts format a30 SQL> SQL> select starts from myTable; STARTS ------------------------------ 01-DEC-01 01.00.00.000000 PM 01-DEC-01 06.00.00.000000 PM 01-DEC-01 01.00.00.000000 PM 3 rows selected. SQL> drop table myTable; Table dropped. SQL>