case循环语句:
1:语法
CASE语句的基本形式为 :
CASE selector
WHEN expression1 THEN result1
WHEN expression2 THEN result2
WHEN expressionN THEN resultN
[ ELSE resultN+1]
END;
2:实例
declare
V_annum char(1):=upper(‘&nom‘);
V_appression varchar2(30);
begin
V_appression :=
case V_annum
when ‘A‘ then ‘Excellent‘
when ‘B‘ then ‘Very good‘
when ‘C‘ then ‘Good‘
when ‘D‘ then ‘bad‘
else ‘No such annum‘
end;
dbms_output.put_line(‘您输入的是‘||V_annum||‘;‘||V_appression);
end;
时间: 2024-09-27 08:14:39