oracle rollback and commit
In the following sql statements:
BEGIN
update开发者_运维百科 table1 set col1 = 'Y';
commit;
update table2 set col2 = 'Y';
rollback;
end;
/
Will it rollback both the updates or only update #2?
Just #2
You might be interested in save points
Your statement will rollback only the current transaction. i.e. the update of table2.
You ended the update of table1 transaction when you issued a commit.
As vc74 says, save points are a useful tool for controlling where you can rollback to without having to issue commits etc.
精彩评论