Let me explain a little bit to what I am trying to do here, I have a table with 12 columns and I want to archive a record before update when the value of a particular field in a record changes.
Well, the answer is no and yes. Meaning: triggers are run on tables, not rows or fields, but that is really not a problem. You can't have a change on any particular column of a row, without it affecting the table. So, just write a function that checks for the old value of the column for any row, and if the value changes, then perform your archiving for that row. Now, set a BEFORE UPDATE (or BEFORE DELETE OR UPDATE) trigger on that table to call this function. Thus, whenever any row is updated, your function will check for a new value in that column, and if there is a new value, it will perform your backup.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.