create or replace procedure m(v_empno in number,v_sal out number ) as
v_ename varchar2(20);
begin
select sal,ename
into v_sal,v_ename
from emp
where empno=v_empno;
if v_sal<1000 then
update emp
set comm=(v_sal*0.1)
where ename=v_ename;
elsif v_sal between 1000 and 1500 then
update emp
set comm= (v_sal*0.15)
where ename=v_ename;
elsif v_sal>1500 then
update emp
set comm=(v_sal*0.2)
where ename=v_ename;
elsif v_sal is null then
update emp
set comm =0
where ename=v_ename;
end if;
end m;
这样的语句可以执行 但是 我换成 case 时
create or replace procedure m(v_empno in number,v_sal out number ) as
v_ename varchar2(20);
begin
select sal,ename
into v_sal,v_ename
from emp
where empno=v_empno;
CASE
when v_sal<1000 then
update emp
set comm=(v_sal*0.1)
where ename=v_ename;
when v_sal between 1000 and 1500 then
update emp
set comm= (v_sal*0.15)
where ename=v_ename;
when v_sal>1500 then
update emp
set comm=(v_sal*0.2)
where ename=v_ename;
when v_sal is null then
update emp
set comm =0
where ename=v_ename;
END;
end m;
却出现了错误
附图
刚学ORACLE 请高手指点。