方法一(推荐):
update 表2
set 表2.c =
(select b
from 表1
where 表1.a = 表2.a)
where exists
(select 1
from 表1
where 表1.a = 表2.a);
尤其注意最后的外层where条件尤为重要,是锁定其批量更新数据的范围。
方法二:
merge into 表2
using 表1
on (表2.a = 表1.a) -- 条件是 a 相同
when matched
then
update set 表2.c = 表1.b -- 匹配的时候,更新
以上所述是www.887551.com给大家介绍的oracle两张表关联批量更新其中一张表的数据,希望对大家有所帮助