begin
DML语句1;
DML语句2;
...
DML语句n;
commit;
end;
/
通过测试,假设DML语句n出现异常,那么DML语句1...n-1所做的操作将会rollback;
begin
savepoint xx;
DML语句1;
DML语句2;
...
DML语句n;
commit;
exception
when others then
rollback to xx;
raise;
end;
/
那么如何实现即便DML语句n出现异常,DML语句1...n-1所做的操作依然能够commit呢???;
方法一:
begin
begin
DML语句1;
exception
when others then
null;
end;
begin
DML语句2;
exception
when others then
null;
end;
...
begin
DML语句n;
exception
when others then
null;
end;
commit;
end;
/
方法二:
begin
DML语句1;
DML语句2;
...
DML语句n;
commit;
exception
when others then
commit;
end;
/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26156924/viewspace-767509/
,如需转载,请注明出处,否则将追究法律责任。