发布网友 发布时间:2022-05-04 13:54
共2个回答
懂视网 时间:2022-05-04 18:16
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
);
热心网友 时间:2022-05-04 15:24
建立主键,或者对关键字段设唯一性约束,就不允许重复数据了