oracle 存储过程 case when then

来源:互联网 发布:生命的意义 知乎 编辑:程序博客网 时间:2024/04/30 15:23
-- Created on 2017/5/12 by ADMINISTRATOR 
declare 
  -- Local variables here
  i integer;
  imonth int;
   updatestr        varchar2(50);
        daystr           varchar2(5);
begin
  imonth:=5;
  -- Test statements here
   case imonth
       when 1 then  daystr:=31; when 2 then daystr:=28;
       when 5 then daystr:=31; else daystr:=30;
       end case;
       dbms_output.put_line(daystr);
       end;

       

-------------------when 后面多个会报错,要end case-----------------

0 0
原创粉丝点击