时间类型也是可以直接相减的;
SQL> select sysdate - (sysdate-1) from dual;SYSDATE-(SYSDATE-1)
-------------------
                  1Executed in 0.016 secondsSQL>

解决方案 »

  1.   

    select next_date - create_date
    from (
      select create_date, lag(create_date,1,null) over (order by create_date) next_date
        from t )
      

  2.   

    SQL> select * from b;B1         B2         B3         B4
    ---------- ---------- ---------- -----------
    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>
      

  3.   

    SQL> select * from b;B1         B2         B3         B4
    ---------- ---------- ---------- ---------------------
    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>
      

  4.   

    请问Oracle的Date类型也可以直接减吗?