Luoml's blog

oracle批量更新多个字段

1
2
3
update table1 t1 
set (a,b,c) = (select a,b,c from table2 t2 where t1.a=t2.a)
where exists (select 1 from table2 t2 where t1.a=t2.a);

注意:加上where exists语句是为了避免将不匹配的记录更新为null

Fork me on GitHub