oracle 避免重复插入数据
using keyword :merge INTO ----------------------- merge into t1 using (select 1 a,3 b from dual) t2 on (t1.a = t2.a) when matched then update set t1.b = t1.bt2.b when not matched then insert (t1.a,t1.b) values(t2.a,t2.b) ------------------
using keyword :merge INTO
-----------------------
merge into t1 using
(select 1 a,3 b from dual) t2
on (t1.a = t2.a)
when matched then update set t1.b = t1.b+t2.b
when not matched then insert (t1.a,t1.b) values(t2.a,t2.b)
------------------------------------
merge INTO SCNMON_DSMT_LV t1 USING
(SELECT 10916000 node_id FROM dual
) t2 ON (t1.lv_node_id = t2.node_id)
WHEN NOT matched THEN
INSERT
(
t1.lv_key,
t1.lv_node_id
)
VALUES
(
SEQ_SCNMON_DSMT_LV.nextval,
t2.node_id
);