troubleshooting Question

diff between 2 idential tables

Avatar of mahjag
mahjag asked on
Oracle Database
25 Comments1 Solution381 ViewsLast Modified:
Hi

Wanted to compare two identical oracle tables - traditionally I would do something like this

select col1..col4
from tableA
minus
select col1...col4
from tableB
union all
select col1..col4
from tableB
minus
select col1...col4
from tableA

can this be written in ANSI SQL way like this - can you verify the code and tell me if this will work

select col1..col4 from
(
select col1..col4 from tableA
) old_table
full outer join
(
select col1..col4
from tableB
) new_table
on (old_table.col1 = new_table.col1 and old_table.col5 = new_table.col5)
group by col1..col4
--having old_table.col3 <> new_table.col3  --commented since I am trying to find out what column values are different

Which sql tells exactly what is in tableA not in TableB and vice versa - in tableB not in tableA

I need to get this today and any help appreciated-
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 25 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 25 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros