存储过程else if

select elsif 选出员工工资根据类型加薪
create or replace procedure Proc_emp_salary is

c_manager constant number :=0.1;
c_salesman constant number :=0.3;
v_job varchar(100);
begin
select job into v_job
from emp where emp.empno='7566';
if v_job='SALEMAN'
then
update emp t set t.sal=t.sal*(1+c_manager) where empno='7566';
elsif v_job ='MANAGER'
then
update emp t set t.sal=t.sal*(1+c_salesman) where empno='7566';
end if;

dbms_output.put_line(v_job);
exception
when no_data_found
then
dbms_output.put_line('没有找到数据');


end Proc_emp_salary;

posted @ 2018-10-29 12:00  淡蓝浅紫  阅读(1504)  评论(0编辑  收藏  举报