- consists of datetime fields: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
TimeZone_Hour, TimeZone_Minute, TimeZone_Region, TimeZone_Abbr
1) TIMESTAMP ( TIMEZONE 저장 X )
2) TIMESTAMP WITH TIME ZONE ( TIMEZONE 저장 O, 출력 O )
3) TIMESTAMP WITH LOCAL TIME ZONE ( TIMEZONE 저장 O, 출력 X )
- stored : normalized to the db time zone
- retrieved: adjusted to the session time zone
alter session set time_zone = '+09:00';
drop table ts_test purge;
create table ts_test (
ts timestamp(0)
, ts_wtz timestamp(4) with time zone
, ts_wltz timestamp with local time zone --> default: 6자리
);
insert into ts_test values (current_date, current_date, current_date);
insert into ts_test values (sysdate, sysdate, sysdate);
commit;
col ts format a30;
col ts_wtz format a35;
col ts_wltz format a30;
select * from ts_test;
alter table ts_test
modify (ts timestamp(9), ts_wtz timestamp(3) with time zone);
==> ERROR : ORA-30082: datetime/interval column to be modified must be empty to decrease fractional second or leading field precision
alter table ts_test
modify (ts timestamp(9), ts_wtz timestamp(7) with time zone);
select * from ts_test;
'Oracle > SQL Fundamentals II' 카테고리의 다른 글
14일차 # 5-18: INTERVAL data types (0) | 2012.04.23 |
---|---|
14일차 # 5-12: TIMESTAMP Fields (0) | 2012.04.23 |
14일차 # Datetime (0) | 2012.04.23 |
14일차 # 5-5: 세션의 현재 날짜 및 시간 관련함수들 (0) | 2012.04.23 |
14일차 # dbtimezone vs. sessiontimezone (0) | 2012.04.23 |