oracle diff: how to compare two tables?

后端 未结 12 2094
忘了有多久
忘了有多久 2021-01-31 03:22

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?

12条回答
  •  爱一瞬间的悲伤
    2021-01-31 03:55

    Try This,

    alter session set "_convert_set_to_join"= true;

    The other alternative is to rewrite the SQL query manually [replacing the minus operator with a NOT IN subquery] evidences about 30% improvement in execution time .

     select * 
       from A 
        where (col1,col2,?) not in 
       (select col1,col2,? from B) 
       union all 
       select * from B 
      where (col1,col2,?) not in 
      (select col1,col2,? from A); 
    

    I have referred from this post click here

提交回复
热议问题