-- 删除procedure
drop procedure if exists batchInsert;
-- 创建procedure
DELIMITER $$
create procedure batchInsert(startNum int, endNum int)
begin
declare num int;
set num = startNum;
while num < endNum DO
insert into tab values (num, 'name');
set num = num + 1;
end while;
end $$
DELIMITER ;
-- 调用
call batchInsert(0, 10000);
03-02
2915