cerate or replace procedure p
is 
   cursor c is
      select * from emp2 for update;
begin
   for v_emp in c loop
      if(v_temp.deptno = 10) then
          update emp2 set sal =sal +10 where current of c;
      elsif(v_temp.deptno = 20) then
  update emp2 set sal =sal +20 where current of c;
      else
          update emp2 set sal =sal +50 where current of c;
      end if;
      end loop;
      commit;
end;

解决方案 »

  1.   

    cerate or replace procedure p
    is  
      cursor c is
      select * from emp2 for update;
    begin
      for v_emp in c loop
      if(v_emp.deptno = 10) then
      update emp2 set sal =sal +10 where current of c;
      elsif(v_emp.deptno = 20) then
    update emp2 set sal =sal +20 where current of c;
      else
      update emp2 set sal =sal +50 where current of c;
      end if;
      end loop;
      commit;
    end;
    把你的v_temp改成v_emp
    或者把for v_emp in c loop  改成 for v_temp in c loop
      

  2.   

    试过了可以 你把变量都写对了 别一会v_emp 一会v_temp