Alex Rivera | Logout

oracle diff: how to compare two tables?

Asked 2009-03-27T04:16:58.510
43

Suppose I have two tables, t1 and t2 which are identical in layout but which may contain different data.

What's the best way to diff these two tables?

Edit
Report

1 Answer

81

Try this:

(select * from T1 minus select * from T2) -- all rows that are in T1 but not in T2
union all
(select * from T2 minus select * from T1)  -- all rows that are in T2 but not in T1
;

No external tool. No performance issues with union all.

answered 2010-07-29T19:58:32.563

Your Answer