存储过程:while

来源:互联网 发布:c语言库函数哪些 编辑:程序博客网 时间:2024/05/16 19:33
drop table if exists t;create table t (s1 int);    insert into t values (5);  select * from t;-- --------------------------------------------------drop procedure if exists p14;delimiter // create procedure p14 ()  begin    declare v int;    set v = 0;    while v < 5 do      insert into t values (v);      set v = v + 1;    end while;  end; //   delimiter ;call p14();select * from t;/*+------+| s1   |+------+|    5 ||    0 ||    1 ||    2 ||    3 ||    4 |+------+*/

原创粉丝点击