首頁  >  文章  >  資料庫  >  cursor-mysql中存储过程无法创建成功

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

WBOY
WBOY原創
2016-06-06 09:39:341095瀏覽

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 ;

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn