时间类型也是可以直接相减的;
SQL> select sysdate - (sysdate-1) from dual;SYSDATE-(SYSDATE-1)
-------------------
1Executed in 0.016 secondsSQL>
SQL> select sysdate - (sysdate-1) from dual;SYSDATE-(SYSDATE-1)
-------------------
1Executed in 0.016 secondsSQL>
from (
select create_date, lag(create_date,1,null) over (order by create_date) next_date
from t )
---------- ---------- ---------- -----------
2 2005 火车 2005-8-15 1
3 2005 轮船 2005-8-15 1
1 2005 飞机 2005-8-15 1Executed in 0.031 secondsSQL> select (a.b4-b.b4)*24*60*60 "秒" from b a,b b where a.b1=b.b1+1; 秒
----------
34
4Executed in 0.031 secondsSQL>
---------- ---------- ---------- ---------------------
2 2005 火车 2005-8-15 11:43:39
3 2005 轮船 2005-8-15 11:43:43
1 2005 飞机 2005-8-15 11:43:05Executed in 0.031 secondsSQL> select (a.b4-b.b4)*24*60*60 "秒" from b a,b b where a.b1=b.b1+1; 秒
----------
34
4Executed in 0.015 secondsSQL>