发布网友 发布时间:2024-09-27 16:06
共1个回答
热心网友 时间:2024-09-27 22:37
drop procedure if exists type;
delimiter $
create procedure type(
in shuruxuehao VARCHAR(20),
out shuchuxuefen int(11)
)
BEGIN
set shuchuxuefen = 0;
set @num = 0;
set @xuefen = 0;
select sum(chengji1 +chengji2 + ... + chengjiN )/ n as num,xuefen into
@num, @xuefen from table where xuehao = shuruxuehao;/*chengji 是各科成绩的字段*/
if num >=60 then
set shuchuxuefen = @xuefen;
else
set shuchuxuefen = 0;
end if ;
END
$
delimiter ;