3,491
社区成员
发帖
与我相关
我的任务
分享
update table_a A
set (a, b, c ,d, e ,f ,g)
= ( select NVL(A.a,B.a),NVL(A.b,B.b),…… from table_b B where id=A.id )
where exists (select 1 from table_b B where id=A.id)
update table_a
set (a, b, c ,d, e ,f ,g)
= ( select a, b, c ,d, e ,f ,g from table_b where id=table_a.id)
where exists (select 1 from table_b where id=table_a.id)
MERGE INTO ta p
USING tb np
ON (p.c1 = np.c1 and p.c2 = np.c2) --连接条件
WHEN MATCHED THEN
UPDATE
SET p.c3 = nvl(np.c3, p.c3), p.c4 = nvl(np.c4, p.c4) --注意此处update的字段不能作为连接字段(不能更新c1,c2字段)
WHERE p.c4 = 'sasfdsa' --可以叫条件过滤