for cv in cur_bad loop
begin
delete from aa where id=cv.id;
delete from bb where id=cv.id;
update cc set flag_q=0,flag_lock=0 where id=cv.id;
end;
end loop;
commit;
操作aa.bb.cc表当中,任何一步出错,将回滚到初始状态,如何写?
exception
when ??????
最初由 wzg7711 发布
[B]for cv in cur_bad loop
begin
delete from aa where id=cv.id;
delete from bb where id=cv.id;
update cc set flag_q=0,flag_lock=0 where id=cv.id;
end;
end loop;
commit;
操作aa.bb.cc表当中,任何一步出错,将回滚到初始状态,如何写?
exception
when ?????? [/B]
不明白你的意思。
begin
delete from aa where id=cv.id;
delete from bb where id=cv.id;
update cc set flag_q=0,flag_lock=0 where id=cv.id;
end;
其中任何一条语句出错,系统都将ROLLBACK到BEGIN之前。系统将BEGIN。。。END之间的语句作为一条语句处理。