0 down vote favorite Here is the scenario, I am writing a procedure which performs DML(insert) operations on multiple tables. In case of exception I need to rollback data from most of two table and drop a newly created table.
Example:
Procedure{
1 create table1
2 insert into table2
3 insert into table3
Exception
WHEN OTHERS THEN
IF DBMS_SQL.IS_OPEN(cur) THEN
DBMS_SQL.CLOSE_CURSOR(cur);
END IF;
RAISE;
}
Now the question is that if insert fails on table2 then I need to drop table1 as well and if insert fails on table3 then I need to rollback the insert that has already happened on table2 and also drop table1.
I'm not sure how to do that in the "Exception" part of pl-sql procedure. Any help would be highly appreciated.
Aucun commentaire:
Enregistrer un commentaire