如果还有判断已经有是否重复,有了就更新,没有就插入
建议使用 类似
merge into hwicd.t_handle_reply_info a
using t_tmp_handle_reply_info b
on (a.handleid = b.handleid)
WHEN MATCHED THEN
UPDATE SET a.updatetime=b.updatetime,
a.handleopinion =b.handleopinion
WHEN NOT MATCHED THEN
insert ( a.handleid,
a.orderid,
a.inchargedept,
a.handleper,
a.handleopinion,
a.handledate,
a.state,
a.statetime,
a.createtime,
a.updatetime)
VALUES (b.handleid,
b.orderid,
b.inchargedept,
b.handleper,
b.handleopinion,
b.handledate,
b.state,
b.statetime,
b.createtime,
b.updatetime);
这个意思?
select b.owner, b.object_name
from b
where not exists (select 1 from a where b.object_id = a.object_id);
[/quote]
不对,拷贝错SQL了
应该是这个:
insert into b
select a.*
from a
where not exists (select 1 from b where b.id = a.id)