[Quote=引用 8 楼 vstian 的回复:]
update A a
set a.sm_code= (select sm_code from B b where a.id_no=b.id_no);
改成这样功能是一样的吗 ????
[/Quote]
要加个条件
update A a
set a.sm_code= (select sm_code from B b where a.id_no=b.id_no)
where exists(select 1 from b where id_no=a.id_no);
[Quote=引用 6 楼 shiyiwan 的回复:]
9i用还要加when not matched then ....
update A a set a.sm_code = (select b.sm_code from B b where a.id_no = b.id_no ) where exists
(select 1 from B c where a.id_no = c.id_no );
[/Quote]
楼主就试试加when not matched吧
想当初我就是通过merge into 认识shiyiwan的,嘿嘿