-- case表达式在begin end 中的使用,记得最后end 后面要加上case
CREATE procedure procedure7(in score int)
begin
case
WHEN score >100 then SELECT '出错啦!';
when score BETWEEN 90 and 100 then SELECT '优秀';
when Score >=80 then SELECT '良好';
when score >=60 then SELECT '及格';
ELSE SELECT '不及格';
end case;
end
CALL procedure7(80);
CREATE procedure procedure8(in score int)
begin
case
WHEN score >100 then SELECT '出错啦!' 成绩;
when score BETWEEN 90 and 100 then SELECT '优秀'成绩;
when Score >=80 then SELECT '良好'成绩;
when score >=60 then SELECT '及格'成绩;
ELSE SELECT &
sql-case语句、if结构以及循环
最新推荐文章于 2021-10-16 12:53:29 发布