mysql的存储过程带参数的怎么写
1个回答
展开全部
以下代码运行通过:
delimiter $$;
create procedure lucia_proc16(count int)
begin
DECLARE name_proc VARCHAR(20) CHARACTER SET utf8;
DECLARE sex_proc VARCHAR(4) CHARACTER SET utf8;
DECLARE age_proc INT(10);
DECLARE class_proc VARCHAR(20) CHARACTER SET utf8;
DECLARE Addr_proc VARCHAR(50) CHARACTER SET utf8;
DECLARE i INT;
set i = 1;
set sex_proc = '女';
set age_proc = 20;
set class_proc = '山治班';
set Addr_proc = '北京市朝阳区';
while i<count do
set name_proc = CONCAT('露西亚',i);
insert into students(Name,Sex,age,class,Addr)values(name_proc,sex_proc,age_proc,class_proc,Addr_proc);
set i = i+1;
end while;
end
$$;
delimiter;
call lucia_proc16(500);
运行效果:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询