Herndon wrote:You should remove the first COMMIT. You need to carry out the deleation of child and parent as a single transaction. So your delete statements must be like
I have a task to delete Parent/child table records (On Delete: No action). I was getting integrity constraint error while I was trying to delete a parent record(this is obvious).
I wrote a pl/sql block to perform this action.
delete from child;
Commit; -- --> Can I ignore it ?
delete from Parent;
Do I need to write a commit after deleting the record from child table ?.
Thanks in Advance.
Edited by: Herndon on Jan 31, 2013 3:29 PM
Because if your parent delete fails then the child records that are already deleted will be ROLLBACK'ed.
begin delete from child; delete from parent; commit; end; /