Update in another row in the same table by Trigger

Asked

Viewed 1,171 times

1

Is there any way to update in the same table, being in another row, through a after insert or before insert?

1 answer

1

According to this response from Stackoverflow, This is not possible in Mysql. Excerpt from documentation:

A stored Function or Trigger cannot Modify a table that is already being used (for Reading or writing) by the statement that Invoked the Function or Trigger.

An alternative suggested in the same answer is to create a stored procedure that makes the action of trigger plus the update next to the same transaction.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.