存储过程调用结果为null

问题遇到的现象和发生背景

这是sc表

img


这是插入后的内容

img

问题相关代码,请勿粘贴截图

create procedure p3(in sno varchar(9))
begin
declare grade int;
declare temp int;
declare count int;
declare score_cursor cursor for select Grade from sc where Sno=sno;
declare exit handler for not found close score_cursor;
select count(*) into count from sc where Sno = sno;

OPEN score_cursor;

WHILE true DO
fetch score_cursor into grade;
INSERT into grade values(grade);
set temp := temp + grade;
END WHILE;
select temp;

end;

call p3('201215121');

运行结果及报错内容

call p3('201215121')

OK
时间: 0.02s

我的解答思路和尝试过的方法

我不知道为什么没有输出结果,不知道我的存储过程对不对

我想要达到的结果