Is there any slick way to create a SQL statement in Oracle to display only fields that have changed? We have a Data table and a related Audit table, with the same field names. I can join them on the proper key fields and then I can check every field individually for changes as:
SELECT
t.FIELD1,
a.FIELD1 AUDIT_FIELD1,
t.FIELD2,
a.FIELD2 AUDIT_FIELD2,
t.FIELD3,
a.AUDIT_FIELD3,
etc
...
FROM
DATA_TABLE t
INNER JOIN
AUDIT_TABLE a
ON
a.EMP_ID = t.EMP_ID
...
WHERE
a.FIELD1 <> t.FIELD1
OR
a.FIELD2 <> t.FIELD2
OR
a.FIELD3 <> t.FIELD3
etc etc..
And I wind up with X number of rows where I have at least one changed field per row, but I have to then eyeball all the results to find which of the fields changed.
It seems I should be able to do some kind of query that basically says "For Each Field In The Table If It Doesn't Match The Other Table Display The Field Name and Value."
This all needs to be done in SQL because corporate requires us to use a separate query/reporting tool that can't create any objects (tables, views, triggers, SPs, etc) on the Oracle back-end database.