I'm looking at creating a procedure that will allow me to check to see if data has changed in a column from staging table compared with the reporting table. Yep simple
select * from stage_tbl s
where exists (select 1 from report_tbl r
where s.id = r.id
and s.compare_col_a <> r.compare_col_a
but .... I have a number of columns to compare between the two table and I can't rely on the columns having the same name. So I have created a mapping table that consists of the column names between the two tables. Though how can I make 'and s.compare_col_a <> r.compare_col_a' dynamic so it accepts the other compare columns such as 'and s.compare_col_b <> r.compare_col_b'
Your help would certainly be appreciated