# 创建数据库
create database jdbc_text;
# 使用数据库
use jdbc_text;
# 创建数据表
create table jdbc_table(
id int auto_increment primary key ,
name varchar(10) not null
);
# 创建存储过程
delimiter "$";
create procedure batchInsert(in args int)
begin
declare i int default 1;
start transaction ;
while i <=args do
insert into jdbc_table(id, name) values (i,concat('小霸王-',i));
set i=i+1;
end while;
commit;
end
"$";
# 导入一千条数据
call batchInsert(1000);
Mysql使用存储过程批量插入数据
最新推荐文章于 2024-06-28 13:05:12 发布