on delete cascade not firing trigger Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of on delete cascade not firing trigger without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have a table called ‘player_instance’ and then a table called ‘penalties’ (which has a foreign key referencing player_instance). I also have a table called ‘scores’.

I have a DELETE TRIGGER on penalties such that if a row is deleted then it will alter a column in scores. I know this works – when a penalty is deleted it will decrease a column in scores.

I also have a ON DELETE CASCADE where if player_instance is deleted then all associated penalties will also be deleted. I know this works too.

But when player_instance is deleted it will only delete the relevant penalties and not fire the trigger to alter scores. Can anyone help me understand why this is not working?

Many thanks


‘Triggers are not activated by foreign key actions.’



Can anyone help me with a workaround?

We are here to answer your question about on delete cascade not firing trigger - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji