DELIMITER // # 使用delimiter关键字//
create procedure test() # 创建存储过程
begin
declare i int default 0; # 声明一个默认值为0的局部变量i
while i<100000 do # 开始循环
insert into books(name)value("test"); # books是表名, name是字段名 test是字段值
set i=i+1; # 使用set为参数赋值
end while;
end //
DELIMITER ; # 将结束符重新定义回结束符为";"
call test(); # 调用函数
浙公网安备 33010602011771号