Oracle PL/SQL/Date Timezone/SESSIONTIMEZONE

Материал из SQL эксперт
Перейти к: навигация, поиск

Adjust your session time zone to -08:00

   
SQL>
SQL>
SQL> create table t(
  2      c1 timestamp with time zone,
  3      c2 timestamp with local time zone
  4  )
  5  /
Table created.
SQL>
SQL> insert into t (c1,c2)values( current_timestamp, current_timestamp );
1 row created.
SQL>
SQL> select * from t;

C1
------------------------------------------------------
C2
------------------------------------------------------
26-OCT-09 10.31.38.026000 AM -06:00
26-OCT-09 10.31.38.026000 AM
1 row selected.
SQL>
SQL> alter session set time_zone = "-08:00";
Session altered.
SQL>
SQL> select * from t;

C1
------------------------------------------------------
C2
------------------------------------------------------
26-OCT-09 10.31.38.026000 AM -06:00
26-OCT-09 08.31.38.026000 AM
1 row selected.
SQL>
SQL> drop table t;
Table dropped.



Determine your session time zone:

   
SQL>
SQL> select sessiontimezone from dual;

SESSIONTIMEZONE
------------------------------------------------------
-08:00
1 row selected.
SQL>



Get your session time zone using the SESSIONTIMEZONE() function

 
SQL>
SQL> --Get your session time zone using the SESSIONTIMEZONE() function
SQL>
SQL> SELECT SESSIONTIMEZONE FROM dual;
SESSIONTIMEZONE
---------------------------------------------------------------------------
PST
SQL>
SQL>