CREATE OR REPLACE PROCEDURE Proc_Calculat_Visit(mi in integer)
IS
CURSOR cur IS select l.bookid as bookid , count(l.id) as vt from visit_log l where l.createdate>=(sysdate-mi/1440) group by l.bookid;
BEGIN
for item in cur loop
begin
update book b set b.visittotal=(b.visittotal+item.vt) where b.id=item.bookid;
end;
end loop;
commit;
END;
IS
CURSOR cur IS select l.bookid as bookid , count(l.id) as vt from visit_log l where l.createdate>=(sysdate-mi/1440) group by l.bookid;
BEGIN
for item in cur loop
begin
update book b set b.visittotal=(b.visittotal+item.vt) where b.id=item.bookid;
end;
end loop;
commit;
END;
when others then
exception
when too_many_rows then