MySQL Forums
Forum List  »  Triggers

Re: Update of a single column triggers update of unrelated one
Posted by: irek kordirko
Date: March 12, 2012 03:42PM

Yannick Gansemans Wrote:
-------------------------------------------------------
>
> Why is the name field updated by the trigger? How
> do I avoid that (the update trigger should be able
> to detect if a vaulue was passed for the 'name'
> column)?

You cannot detect if the update changes some column or not.
NEW.column always contains a new value of a column, even the column is not updated.
However, you can compare an OLD.value with a NEW.value - if they differ that means the update changed the column.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Update of a single column triggers update of unrelated one
2261
March 12, 2012 03:42PM


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.