create or replace procedure proc1
is
cursor c is
select * from emp for update;
begin
for v_emp in c loop
if(v_emp.deptno=10) then
update emp set sal=sal+10 where current of c;
elsif(v_emp.deptno=20) then
update emp set sal=sal+20 where current of c;
else
update emp set sal=sal+50 where current of c;
end if;
end loop;
commit;
end;
存储过程创建以后又两种执行方式
exec proc1;
begin
proc1;
end;
is
cursor c is
select * from emp for update;
begin
for v_emp in c loop
if(v_emp.deptno=10) then
update emp set sal=sal+10 where current of c;
elsif(v_emp.deptno=20) then
update emp set sal=sal+20 where current of c;
else
update emp set sal=sal+50 where current of c;
end if;
end loop;
commit;
end;
存储过程创建以后又两种执行方式
exec proc1;
begin
proc1;
end;