谁手有 PL/SQL 对比个表的数据是否完全相同 的过程!拿出来晒晒!
   大家相互学习一下!   看看执行效率如何!   (测试数据使用)

解决方案 »

  1.   

    1.使用minus,使用集合求差,如果返回的记录集为空,代表记录完全一样
    select * from a
    minus
    select * from b
    2.使用not exists.效率高。
    select * from a where not exists (select * from b where a.col1=b.col2 and a.col2=b.col2 ......)
      

  2.   

    MERGE一下,如果存在更新和插入就说明存在差异
      

  3.   


    1.根据主key关系,求存在
     select * from A exists (select 1 from B where A.id = B.id)2.求交集minus
      

  4.   

    不仅仅是固定的一对表!要做一个通用的!感觉楼上的还不太满意!比如 大家可以想想 先对比 列数->行数->主键->详细对比,一步一步来!还没有 想好,思考实现中
      

  5.   

    表定义对比pl/sql developer自己就有
    数据对比使用楼上方式是可以的,关键你要的比较结果达到什么程度?
    如果只是判断数据相同否,写存储过程使用动态SQL就行了。
    要比较明细,做一个类似beyond compare的完善工具?难。
      

  6.   

    就是对账吧
    按照主键,来个out join,然后筛选想比对的非主键列就可以了
      

  7.   

    直接minus
    select * from tba minus select * from tbb
    union all
    select * from tbb minus select * from tba--有数据则不相同,木有则相同
      

  8.   

    直接minus
    select * from tba minus select * from tbb
    union all
    select * from tbb minus select * from tba这样效率怎么样?????
      

  9.   

     比较慢建议使用not exists
      

  10.   

    如果 tba  tbb 都是海量数据表!
    用 not exists 也行吗!