MySQL Forums
Forum List  »  Triggers

Update Triggers...how to figure out which columns have changed
Posted by: Richard Foster
Date: January 25, 2006 09:53AM

Let's assume you have a table, X, with columns A, B, and C. If you create an update trigger on X, how do you determine which one of the columns has changed? And, don't say that you can compare the OLD value to the NEW value as that doesn't work. If the update statement is the following, update X set B = 'house' where A = 1, the update trigger returns NULL for the value of NEW.C. So, if I were to compare NEW.C to OLD.C, I would conclude that an update on C had occurred because 'house' <> NULL. But, no update on column C occurred. So, how do I detect which columns have been updated?

Thanks.

- Rich

Options: ReplyQuote


Subject
Views
Written By
Posted
Update Triggers...how to figure out which columns have changed
2927
January 25, 2006 09:53AM


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.