Subject Question on Ref Integrity during Trigger
Author Myles Wakeham
I am attempting to update a separate table with data in the AFTER INSERT
phase of a trigger. But there is a foreign key constraint on the table I
wish to create new records in, as a result of the insert into the table with
the trigger. This constraint requires that the data in the table I'm
updating already be in existence.

Hence when I go to create the additional records in the related table, I get
a 'Violation of foreign key constraint' as I can't insert new records in
this table that reference the record I'm creating. I guess its because that
record hasn't actually been saved when the trigger is firing?

Anyway what is the trick here? Do I have to manually drop the foreign key
constraint or is there a better strategy for dealing with this sort of thing
I should be using?


Myles Wakeham
Director of Engineering
Tech Solutions Inc.
Scottsdale, Arizona USA
Phone (480) 451-7440