首页 > 数据库 > Oracle > 對 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;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/66634/viewspace-805690/ ,如需转载,请注明出处,否则将追究法律责任。