写个简单的存储过程:
选用scott的emp表。给员工涨工资,大于2000的涨50,大于1000的涨100,其他的涨150:
create or replace procedure addsal(employno varchar2) is
increment number;
salary number;
begin
select sal into salary from emp
where empno=employno;
if salary>=2000 then increment:=50;
elsif salary>=1000 then increment:=100;
else increment:=150;
end if;
update scott.emp
set sal=sal+increment
where empno=employno;
end;
exec addsal('7369');