在PL / SQL过程中更改TIME_ZONE

时间:2011-03-15 15:53:43

标签: stored-procedures plsql oracle11g

有没有办法在存储过程/包中执行ALTER SESSION SET time_zone ='America / New_York'?我想将会话TZ更改为NY,然后将其恢复为之前的状态。

1 个答案:

答案 0 :(得分:2)

SQL> begin
  2      execute immediate 'alter session SET TIME_ZONE=''America/New_York''';
  3  end;
  4  /

PL/SQL procedure successfully completed
SQL> select sessiontimezone from dual
  2  /

SESSIONTIMEZONE
---------------------------------------------------------------------------
America/New_York

SQL>