您当前的位置: 首页 >  童心同萌 oracle

Oracle中case语句的使用

童心同萌 发布时间:2019-02-13 11:49:02 ,浏览量:4

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;

 

关注
打赏
查看更多评论

童心同萌

暂无认证

  • 4浏览

    0关注

    87博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录