标签:upd 例子 mat value 修改 values date not rac
语法:
merge into 目标表 a
using 源表 b
on(a.条件字段1=b.条件字段1 and a.条件字段2=b.条件字段2 ……)
when matched then update set a.更新字段=b.字段
when not matched then insert into a(字段1,字段2……)values(值1,值2……)
例子:
MERGE INTO T T1
USING (SELECT ‘1001‘ AS a, 2 AS b FROM dual) T2
ON ( T1.a=T2.a)
WHEN MATCHED THEN
UPDATE SET T1.b= T2.b
WHEN NOT MATCHED THEN
INSERT (a,b) VALUES(T2.a,T2.b);
标签:upd 例子 mat value 修改 values date not rac
原文地址:https://www.cnblogs.com/iullor/p/14822631.html