mysql 存储过程结果不对 代码已贴

为什么我的mysql存储结构 出不来相加的结果!,
游标不是只有 select 的时候才会取出来吗?循环来取如果 取不到了 那么 设置为空 结束循环 返回相加的结果,我这个空是真的不理解!

img

create procedure asdqwe11()
begin
declare qwe int;
declare asdz int default 1;
declare yb cursor for select id from t_disease_flow;
declare continue handler for not found set qwe = 1;

open yb;
    set @asd = 0;
    while qwe <> 1 do
        begin
        
            fetch  yb into asdz;
            set @asd = @asd+asdz;
            
        end;
    end while;
    select @asd;
close yb;

end;

call asdqwe11()

qwe没有初值啊,你确定循环执行了吗,不是因为qwe没初值所以报错了所以把qwe设置成1了