您的位置:首页 > 数据库 > MySQL

mysql存储过程简单例子

2016-05-17 12:34 447 查看

    一般需要测试数据时,一条条插入太过麻烦,通过存储过程可以编写sql脚本快速插入

针对mysql数据库,
drop  procedure if exists prosgame;

create procedure prosgame()

     begin

     declare i int;

    set i=6;

    while i<11 do

        insert into game(gameName,gameType,classify) values('s',1,1);

        set i=i+1;

     end while;

     end;

call prosgame(); 

通过上述运行上述脚本可插入5条数据
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 存储