Skip to content
Advertisement

Value referenced by NEW on an unchanged column in an UPDATE trigger

I have a table Group_Members with a DELETE trigger and an UPDATE trigger. The DELETE trigger updates some rows in A hence invoking the UPDATE trigger.

Here’s the DELETE trigger code:

Here’s the invoked UPDATE trigger code:

My question is: what would be the value referenced by NEW in the UPDATE trigger given the column value has not been changed i.e. in this scenario, what would be the value referenced by NEW.Affector?

Advertisement

Answer

new has the column values as they will be after the UPDATE. So if affector isn’t changed by the UPDATE, its value after the UPDATE will be the same value it had before. In that case new.affector has the same value as old.affector.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement