当前位置:Gxlcms > mysql > 创建存储过程向表中循环添加数据

创建存储过程向表中循环添加数据

时间:2021-07-01 10:21:17 帮助过:98人阅读

CREATE PROCEDURE dowhile() BEGIN DECLARE n int; set n=1; WHILE n=1000 do INSERT into hasindex(num) VALUES (n); set n=n1; END WHILE; END; CALL dowhile();

CREATE PROCEDURE dowhile()
BEGIN
DECLARE n int;
set n=1;
WHILE n<=1000
do
INSERT into hasindex(num) VALUES (n);
set n=n+1;
END WHILE;
END;
CALL dowhile();

人气教程排行