Rollback with savepoint usage
Hi, I've coded the following, but not sure if I'm doing the right thing:
procedure try_rollback
as
begin
savepoint start_txn;
[update sql statement]
[insert sql statement]
commit;
exception
when others
then
rollback to start_txn;
raise;
end;
What I'm trying to do is, if either update or insert statments throw exception, rollback will undo everything up to and including that statement starting from the savepoint. Am I doing it right?
Many thanks.