开发者

oracle rollback and commit

开发者 https://www.devze.com 2023-04-07 23:21 出处:网络
In the following sql statements: BEGIN update开发者_运维百科 table1 set col1 = \'Y\'; commit; update table2 set col2 = \'Y\';

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消