Skip to Main Content

Oracle Database Discussions

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!

Compare two tables to find discrepancy of data

citicbjMay 8 2008 — edited May 8 2008
I have two tables, TableA and TableB. TableB is the source of TableA. TableA is created by select columns from TableB with some where clause. Now TableA contains 691033 rows and TableB contains 691100 rows. There are 67 records discrepancies. I want to know what are these 67 records. So I use these queries to get data.

1.

select * from TableB
minus
select * from TableA
union all
select * from TableA
minus
select * from TableB

I got no records returned. Then I tried second method as

2.

select * from tableB where xxx_id not in (select xxx_id from tableA).

Due to system, this query runs forever. I created Index on xxx_id on both table and run query again. It still runs forever. I have to kill the query process.

Anyone can advise some good method to solve this problem? Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 5 2008
Added on May 8 2008
1 comment
576 views