17,377
社区成员
发帖
与我相关
我的任务
分享
SQL>
SQL> create table test(d1 varchar(20), d2 varchar(20)) ;
Table created
SQL> insert into test
2 values(
3 to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),
4 to_char(sysdate - 1111.11111,'yyyy-mm-dd hh24:mi:ss')
5 ) ;
1 row inserted
SQL> select d1, d2,
2 to_timestamp(d1,'yyyy-mm-dd hh24:mi:ss') - to_timestamp(d2,'yyyy-mm-dd hh24:mi:ss') r
3 from test ;
D1 D2 R
-------------------- -------------------- -------------------------------------------------------------------------------
2016-08-14 10:18:48 2013-07-30 07:38:48 +000001111 02:40:00.000000000
SQL> drop table test purge ;
Table dropped
SQL>