set serveroutput on
declare
a varchar2(10);
b int;
begin
a:='qwer';
b:=length(a);
case b
when 1 then
dbms_output.put_line('字符串a的长度为1');
when 2 then
dbms_output.put_line('字符串a的长度为2');
when 3 then
dbms_output.put_line('字符串a的长度为3');
when 4 then
dbms_output.put_line('字符串a的长度为4');
when 5 then
dbms_output.put_line('字符串a的长度为5');
else
dbms_output.put_line('字符串a的长度大于5');
end case;
end;