Actually, it would not be hard to code
if :new.col1 = :old.col1
and :new.col2 = :old.col2
and :new.col3 = :old.col3
and :new.col4 = :old.col4
and :new.col5 = :old.col5
and :new.col6 = :old.col6
... then
null;
else
insert into etc ...
end if;
Just do a describe on the table and then paste that into a spreadsheet.
You can create a formula in the second spreadsheet column using the column
names from the table in the first column to create the repeated code.
Then just copy the if code column and paste it into a text editor to finish
the trigger code.
Spreadsheets can be very helpful when coding stuff like that.
chuck
-----Original Message-----
From: Joehnk, John
Sent: Monday, June 30, 2003 9:54 AM
To: LazyDBA.com Discussion
Subject: Trigger question for record update
Running Oracle 7.3.4 and have an application (not written in house) that
allows a person to go into an update screen, unfortunately it seems as if
even if the person makes no changes, if they do not back out, it writes - or
updates - the record even if there were no changes.
We wanted to create a history of changes so I created a trigger where after
the update of a record, the old values were written to the history table.
Out history is now full of record that did not really change.
How could I check to see if the record REALLY changed to determine if I need
to write the record to the history table.
the table has 133 columns, so checking each one is possible, but I was
hoping for some way to check the entire record without going column by
column.
Any thoughts?
Thank You
John Joehnk
Scroll Technologies
Oracle LazyDBA home page