日期:2014-05-17 浏览次数:21219 次
select * from t_temp where not exists( select cl1, cl2 from t_original to, t_temp tt where to.cl1=tt.cl1 and to.cl2=tt.cl2 )
------解决方案--------------------
insert into t_diff
select * from t_temp tt
where not exists(
select tt.cl1, tt.cl2
from t_original tor
where tor.cl1=tt.cl1
and tor.cl2=tt.cl2 );
------解决方案--------------------
insert into t_diff
select a.cl1,b.cl2,b.cl3
from t_original a,t_temp b
where a.col1=b.col1 and a.col2<>b.col2
------解决方案--------------------
稍微改一下,参考而已:
INSERT /*+append*/INTO t_diff NOLOGGING(cl1,cl2,cl3) SELECT cl1,cl2,cl3 FROM t_temp t1 WHERE not exists( SELECT /*+hash_aj*/1 FROM t_original t2 WHERE t1.cl1 = t2.cl1 AND t1.cl2 = t2.cl2 );