Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Rollback with savepoint usage

plsql noviceNov 14 2007 — edited Nov 14 2007
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 12 2007
Added on Nov 14 2007
9 comments
854 views