oracle 存储过程

二重分支

create or replace procedure dwk(spempno number) is
v_sal emp.sal%type;
begin
select sal into v_sal from emp where empno=spempno;
if  v_sal<2000 then
update  emp set sal=sal*1.1 where empno=spempno;
end if;
end;

 
create or replace procedure dwk(spName varchar2) is
v_sal emp.sal%type;
begin
select sal into v_sal from emp where ename=spName;
if  v_sal<2000 then
update  emp set sal=sal*1.1 where ename=spName;
end if;
end;
多重分支


create or replace procedure dingweikang1(spno number) is
v_job emp.job%type;
begin
select job into v_job from emp where empno=spno;
if  v_job= 'PRESIDENT' then
 

update  emp set sal=sal+1000 where empno=spno;

elsif v_job='MANAER' then

update  emp set sal=sal+500where empno=spno;

else
update  emp set sal=sal+200 where empno=spno;
end if;
end;
/


 

你可能感兴趣的:(oracle,replace,number,procedure,into)