Connecting Tech Pros Worldwide Help | Site Map

DB2 triggers & Cascading deletes

Newbie
 
Join Date: Nov 2008
Location: Salem Oregon
Posts: 2
#1: Nov 17 '08
We've got a cascading delete being used in DB2. I've built new triggers under the parent/child tables in this cascading delete relationship.

So when they delete the parent, and the cascade activity occurs, I had expected that the delete trigger on the child would always fire before the delete trigger on the parent. But I was wrong! They are firing parent-first child-second!

This is causing me some concern because the sequence of the output from these triggers (an insert into a transaction table) is suggesting the wrong order for the delete sequence of events, which are then to be applied to our remote (Oracle) platform.

The only solution we like right now, is to add a similar cascading delete to the Oracle database. But before we do so, I thought I'd put the question out here to see if maybe there is a way to tell DB2 triggers to fire in child-parent order, instead of parent-child order?

Pete
Reply