mysql_存储过程

其实就是造测试数据

eg:

delimiter $$  //定义结束符号
create procedure test_p11(count int)(默认是in类型)
begin
declare name varchar(20);//定义变量
declare phone int(20);
declare i int;
set i = 0;
while i<count do
set name=CONCAT('安大叔',i);
set phone=18612545+i;
insert into stu (stu_name,phone,salary)values (name,phone,i);
set i=i+1;
end while;
end
$$;
delimiter;//重新恢复结束定义


call test_p11(500);
select count(*) from students;

删除:

drop   procedure   XX;

posted @ 2016-09-23 17:18  D.零下的小书屋  阅读(172)  评论(0编辑  收藏  举报