comparing tables across databases sql refinement ideas required

Posted on 16th Feb 2014 by admin

Hi all

Via pl/sql I need to ensure that data between tables in different databases match (i.e. standby db and development db) I have made the following crude attempt.

SELECT COUNT(*) , SUM(weighted_sales), SUM(retail_value) FROM sales WHERE transaction_time_id = 5663 UNION SELECT COUNT(*), SUM(weighted_sales), SUM(retail_value) FROM sales@TOWARCHRTIBMPROD WHERE transaction_time_id = 5663

if rownumber > 1 then i know that the data for that day doesn't match.

However i don't like the sql i've used here and would like to improve upon it, any ideas? I thought perhaps using pivot to compare the data....

Other forums