1:存储过程的sql如下:
create procedure myproc()
begin
declare num int;
set num=1;
while num <= 100000 do
insert into new_table_test values(num,2,3); set num=num+1;
end while;
end;
2:执行存储过程:
call myproc();
3:此时查询一下数据,就有100000条数据:
select * from new_table_test
使用存储过程插入100000条测试数据
本文介绍了一种使用存储过程批量插入数据的方法。通过创建一个名为 myproc 的存储过程,可以实现向 new_table_test 表中自动插入100000条记录的功能。此方法提高了数据录入效率。





