Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Trigger: iterate over all columns possible?

378979Dec 3 2002
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2003
Added on Dec 3 2002
5 comments
1,411 views