成功执行就给分 ------最佳解决方案-------------------- --try
update mt set (receipt,receipttext)=(select status,statustext from dr where mt.messageid=dr.messageid)
where exists(select * from dr where mt.messageid=dr.messageid); ------其他解决方案--------------------
其实,oracle对多表update有自己比较高效的处理方案
即:对视图的UPDATE语句
update (
select /*+use_hash(mt,dr)*/ receipt,receipttext,status,statustext
from mt,dr where mt.messageid=dr.messageid
)
set receipt=status,receipttext=statustext;
又或者、你可以用存储过程
declare
cursor c is select mt.*,mt.rowid from mt;
begin
for c1 in c
loop
update mt set (receipt,receipttext)=(select status,statustext from dr where mt.messageid=dr.messageid)
where rowid=c1.rowid and exists (select 1 from dr where mt.messageid=dr.messageid);
end loop;
end;