欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

cursor-mysql中存储过程无法创建成功

程序员文章站 2023-12-24 20:22:45
...
mysqlcursor存储

delimiter $$
BEGIN
DECLARE iti varchar(25);
declare maj varchar(25);
declare cla tinyint(1);
declare buffer tinyint(1);
declare grd enum('2014级','2012级','2013级');
declare mycur CURSOR for select institude,major,grade,class from show_information;
open mycur;
fetch mycur into iti,maj,grd,cla;
while(iti is not null)DO
select buffer=count(*) from show_information where institude=iti and major=maj and grade=grd and class=cla;
update statistics set classnum=buffer where institude=iti and major=maj and grade=grd and class=cla;
fetch mycur into iti,maj,grd,cla;
end while;
close mycur;
END
$$
delimiter ;

上一篇:

下一篇: