Bo's Oracle Station

查看: 1063|回复: 0

timestamp with local timezone和dbtimezone

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-10-13 21:47:33 | 显示全部楼层 |阅读模式
  1. --hr
  2. select dbtimezone from dual;

  3. select sessiontimezone from dual;

  4. select  to_timestamp('2010-01-10 12:00:00', 'YYYY-MM-DD HH24:MI:SS'  ) from dual;

  5. create table t07110_a(  a  date, b  timestamp,  
  6.   c timestamp with time zone, d timestamp with local time zone,location varchar2(20)  );

  7. insert into t07110_a values(sysdate,sysdate,sysdate,sysdate,'Shanghai1');
  8. commit;

  9. select  * from t07110_a;

  10. insert into t07110_a      values(current_date,current_date,current_date,current_date,'Shanghai-2');
  11. commit;

  12. select  * from t07110_a;

  13. --sys
  14. select  * from dict_columns c where c.column_name  like '%TZ%';

  15. select  * from V$TIMEZONE_NAMES;

  16. --hr
  17. insert into t07110_a values(to_date('2010-01-10 15:02:00','YYYY-MM-DD HH24:MI:SS'),
  18.                    to_timestamp('2010-01-10 15:02:00','YYYY-MM-DD HH24:MI:SS'),
  19.                    to_timestamp_tz('2010-01-10 15:02:00 +0:0','YYYY-MM-DD HH24:MI:SS TZH:TZM'),
  20.                    to_timestamp_tz('2010-01-10 15:02:00 +0:0','YYYY-MM-DD HH24:MI:SS TZH:TZM'),
  21.                    'Shanghai3');
  22. commit;

  23. select  * from t07110_a;

  24. --sys
  25. alter database set time_zone='+08:00';

  26. select    owner ,table_name from dba_tab_columns where data_type like '%LOCAL TIME ZONE';

  27. drop table oe.orders  cascade constraints;

  28. drop table hr.t07110_a;       

  29. purge dba_recyclebin;

  30. drop user APEX_040200 cascade;

  31. alter database set time_zone='+08:00';

  32. shutdown immediate

  33. startup
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-3 00:17 , Processed in 0.035387 second(s), 24 queries .

快速回复 返回顶部 返回列表