對 Oracle 9i 新數據類型的學習

Timestamp , interval year to month , interval day to second:

create table test_data_type(start_time timestamp(6) , duration_1 interval day(6) to second(6) , duration_2 interval year(2) to month );

insert into test_data_type(start_time) select to_timestamp(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss' ) ,'yyyy-mm-dd hh24:mi:ss.ff') from dual;

select start_time , sysdate , start_time - sysdate from test_data_type;

insert into test_data_type(duration_1)
select interval '5 2' day to hour - interval '1:30' hour to minute from dual;

insert into test_data_type(duration_1)
select interval '5' hour - interval '1:20' hour to minute - interval '30:30' minute to second from dual;

insert into test_data_type(duration_1)
select interval '5' day - interval '1 0:12' day to minute from dual;

insert into test_data_type(duration_2)
select interval '5' year - interval '1-1' year to month from dual;

[@more@]
请使用浏览器的分享功能分享到微信等