MySQL循環

delimiter $$
drop procedure if exists func;
create procedure func()
begin
declare i int;
set i = 1;
while i<10 do
insert into user (user_name)values(i);
set i = i +1;
end while;
end $$

delimiter ;
call func();
drop procedure if exists func;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章