create table ttt as
select sysdate a,1 b , null c from dual
union all
select sysdate+1/24/60 a,2 b , null c from dual
union all
select sysdate+2/24/60 a,3 b , null c from dual
a 时间
b id
c 相差分钟
create or replace procedure p_test715 as
begin
for cr in (select a.rowid,b.a
from ttt a,ttt b
where a.b-1=b.b )
loop
update ttt
set c=(a-cr.a)*24*60
where rowid=cr.rowid;
END LOOP;
COMMIT;
end;
selet (a- lead (a,a))*24*60 over (order by a) from table_name