MySQL Forums
Forum List  »  Triggers

Trigger action FOR EACH ROW question
Posted by: Edward Diener
Date: April 16, 2018 03:12PM

When specifying an UPDATE trigger event for my trigger I would expect that the action I choose when the trigger occurs would only be done for the row in the particular table which has been updated. So I do not understand the FOR EACH ROW part of the trigger syntax for my UPDATE trigger, because it appears the trigger code I specify in the trigger body executes for each row of the table and not just the single row that has been updated. Needless to say I only want the trigger body to be executed for the particular row that has been updated in my UPDATE trigger. How can I determine that ?

Similarly for an INSERT or DELETE trigger event I only want the trigger body to operate on the new row values that have been inserted for the INSERT trigger event and on the old row values that have been deleted for the DELETE trigger event. I understand the use of the OLD and NEW keywords in this context. Do the INSERT and DELETE trigger events also operate on each row in the ON table_name or only on the row that has been added or deleted respectively ?

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger action FOR EACH ROW question
288
April 16, 2018 03:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.