insert into A select * from B where not exists (select 1 from A where A.ID=B.ID)
insert when (not exists (select 1 from表名where 检验重复的条件)) then into表名values(相应的值)select 1 from dual
<wbr></wbr>
本文介绍如何使用SQL语句实现批量插入数据并检查重复记录。通过`INSERT INTO`和`SELECT`语句结合`NOT EXISTS`子查询,确保只插入唯一数据,避免重复插入。同时利用`VALUES`关键字一次性插入多个记录。
insert into A select * from B where not exists (select 1 from A where A.ID=B.ID)
insert when (not exists (select 1 from表名where 检验重复的条件)) then into表名values(相应的值)select 1 from dual
<wbr></wbr>
被折叠的 条评论
为什么被折叠?