Oracle checking existence before deletion in a trigger

Posted on Stack Overflow See other posts from Stack Overflow
Published on 2008-12-17T01:50:17Z Indexed on 2010/06/14 12:42 UTC
Read the original article Hit count: 145

Filed under:
|

I have analyzed a hibernate generated oracle database and discovered that a delete of a row from a single table will spawn the firing of 1200+ triggers in order to delete the related rows in child tables. The triggers are all auto-generated the same - an automatic delete of a child row without checking for existence first. As it is impossible to predict which child tables will actually have related rows, I think a viable solution to preventing the firing of the cascaded delete down a deeply branched completely empty limb, would be to check for the existence of a related row before attempting to delete. In other dbms', I could simply state " if exists....." before deleting. Is there a comparable way to do this in oracle?

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about exists