botang 发表于 2020-10-13 21:47:33

timestamp with local timezone和dbtimezone

--hr
select dbtimezone from dual;

select sessiontimezone from dual;

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

create table t07110_a(adate, btimestamp,
c timestamp with time zone, d timestamp with local time zone,location varchar2(20));

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

select* from t07110_a;

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

select* from t07110_a;

--sys
select* from dict_columns c where c.column_namelike '%TZ%';

select* from V$TIMEZONE_NAMES;

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

select* from t07110_a;

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

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

drop table oe.orderscascade constraints;

drop table hr.t07110_a;       

purge dba_recyclebin;

drop user APEX_040200 cascade;

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

shutdown immediate

startup


页: [1]
查看完整版本: timestamp with local timezone和dbtimezone