hc学习平台

 找回密码
 立即注册
搜索
热搜: 活动 交友 javakc
 › zhangjiafu › 日志

编写带参数的存储过程,将百分制成绩,转换成绩等级’A’,’B’,’C’,’D’,’E’

2021-01-09 18:04:03 查看(284) 回复(0)

要求;

  1. 存储过程要有输入和输出

create procedure chengji(inout i int)

begin

declare n int;


declare result varchar(20);

set n=i;


case

when n>=90 then

set result='A';

when n>=80 then

set result='B';

when n>=70 then

set result='C';

when n>=60 then

set result='D';

else

set result='E';

end case;


select n,result ;


end;

set @x=40;

call chengji(@x);

select @x;

评论 (0 个评论)

facelist

全部作者的其他最新日志



站点统计|举报|Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, , Processed in 0.195171 second(s), 9 queries .

Powered by javakc! X1.0

© 2004-2014 javakc

f1208.com 备案号:京ICP备14030918号-1

返回顶部