mysql存储过程简单例子

来源:互联网 发布:java date日期格式化 编辑:程序博客网 时间:2024/06/06 02:06

    一般需要测试数据时,一条条插入太过麻烦,通过存储过程可以编写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条数据

0 0
原创粉丝点击