question

Mark Anderson avatar image
Mark Anderson asked

Insert trigger not triggering

Hi

Got it working - the reconfigure didn't take effect.

I am struggling to get an insert trigger to fire. I have a parent child relationship with an insert into the parent table triggering the insert into the child table. The trigger on the parent table doesn't fire. The data in the parent table is populated from another trigger.

I have currently got nested triggers switch off but have tested with nested triggers on with no effect.

When I manually run the insert statement below, everything is OK and child records created.

PS. I'm still a bit of a noob at this SQL stuff and any help is appreciated. Thanks

triggerinsert
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hans avatar image
Hans answered

It sounds a bit complicated to me, hard to maintain, hard to debug, triggers firing other triggers. Have you considered building the parent/child record creation into a stored procedure instead of using triggers.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jimsnyder avatar image
jimsnyder answered
@Mark Anderson Put the following code with real names at the beginning of the trigger to see if it is being called. If you get data back, move the query to the end to see if it completed:
INSERT INTO some_table
	some_field
VALUES
	(some text)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.