0

I have a oracle package consisting of many procedures. e.g.

pkg(
proc 1
proc 2
proc 3
);

while executing the package proc 1 gets called first and within proc 1,proc 2 is called. SO what if i face an exception in proc 2 then i want to rollback all the DML's done in proc 1.

James Z
  • 12,209
  • 10
  • 24
  • 44
lobh
  • 33
  • 7

2 Answers2

1

You don't have to do anything, Oracle will perform rollback for you. Just don't commit anywhere within those procedures - let the caller decide whether to commit or not, after everything is done.

Also, don't DDL as it'll implicitly commit everything that has been done so far.

Littlefoot
  • 131,892
  • 15
  • 35
  • 57
0

Adding to what Littlefoot mentioned, please please have in consideration whatever IDE you are working with. There are some settings of auto-commit that I recommend to you that should be turn off. Otherwise, rollbacks won't help.