程序对关系型数据库批量操作

一、批量插入

1.1、oracle批量插入

insert into test(name)
select * from
(select '111' from dual
union all select '222' from dual
union all select '333' from dual
union all select '444' from dual)

 

 1.2、mysql批量插入

insert into test(name) values ('111'),('222'),('333'),('444');

 

二、批量更新

2.1、oracle批量更新

update test set salary = salary + 200  where dept_id = '10000' ;

 

2.2、mysql批量更新

#replace into更新以ID作为更新条件
replace into test(id,name) values ('1110','张三1'),('2220','李四1'),('3330','王五1');

posted @ 2018-12-03 22:55  N神3  阅读(170)  评论(0编辑  收藏  举报