Trigger: iterate over all columns possible?
Hello,
I'm trying to write some triggers to build a very detailed auditing/history.
Here's my question: I'm using after update triggers for each row. Is it possible to iterate over each column to compare the old and new value without knowing the names of these columns? Or do I really have to use dozens of if-statements? I thought of something like (pseudo-code):
for each column do
if (column.newvalue <> column.oldvalue) then
insert statement
end if
end for
Besides that it's short and clear code, this way one doesn't have to modify the trigger once a column is added or dropped. Is this possible somehow?
Thanks in advance.