首页 > 数据库 >oracle数据库实现批量插入功能

oracle数据库实现批量插入功能

时间:2023-02-17 15:23:57浏览次数:39  
标签:insert 批量 数据库 values dual oracle table into select

方式一:用查询出来的数据集插入表中

insert into table(a,b) values select a,b from (select '1' as a,'2' as b from dual union all select '3' as a,'4' as b from dual)

方式二:用多条查询语句的结果集插入表

insert into table(a,b) values select '1' as a,'2' as b from dual union all select '3' as a,'4' as b from dual

方式三:用begin和end关键字实现单独插入多条记录

begin
    insert into table(a,b) values ('1','2');
    insert into table(a,b) values ('3','4');
end;

方式四:用insert all关键字,每条记录前面加个into,最后加一条select语句

insert all
into table(a,b) values ('1','2') 
into table(a,b) values ('3','4') 
select '1' from dual;

 

标签:insert,批量,数据库,values,dual,oracle,table,into,select
From: https://www.cnblogs.com/zhncnblogs/p/17130261.html

相关文章