對 Oracle 9i 新資料型別的學習

ysjxjf發表於2005-09-02

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@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/66634/viewspace-805690/,如需轉載,請註明出處,否則將追究法律責任。

相關文章