Hierarchical Deletion w Cascaded TRIGGERS in SE
Posted in 1995
} Using Informix-SE and ESQL/C v5.01 } } I have several tables organised in a hierarchical (tree) fashion: } a parent has multiple children, which in turn have multiple children, } by defining referential constraints on foreign keys. } } [...details cut...] } } The problem is that the for each parent row, the trigger action (deleting } the child records) will take place AFTER the trigger event (deleting the } parent record). This violates referential constraints since the parent } record cannot be deleted while it is still referenced by child records. } } Can anybody suggest a solution, other than using the OnLine server, } or doing the work manually ? Any suggestions will be appreciated. } } Johnny Farraj johnny@aztech.demon.co.uk Can't you delete the children first? We avoid that problem entirely by deleting parents via a 4gl, and then deleting all orphans. This has the added benefit of deleting bastard children, which sometimes can slip into the system. Of course, we don't use referential constraints, or triggers, or SE, or ESQL/C, so perhaps this response is not even appropriate. __________________________________________________________________ | Clem Akins Standard Disclaimers Apply | |Reynolds Metals Co, Alloys Plant "Climb High, Cave Deep!" | | Muscle Shoals, Alabama USA cwakins@leia.alloys.rmc.com | |________________________________________________________________|