declare
      v_eage emp.eage%type;
      cursor emp_cur
      is
      select eage from emp for update;
begin
      open emp_cur;
      loop
           fetch emp_cur into v_eage;
           exit when emp_cur%notfound;
            
           if v_eage=50 then
                update emp set esal=esal+200 where current of emp_cur;
           else
                update emp set esal=esal+300 wher current of emp_cur;
           end if;
      end loop;
      close emp_cur;
end;为什么上述代码会报SQL命令未正确结束啊?

解决方案 »

  1.   

    where写错了declare
      v_eage emp.eage%type;
      cursor emp_cur
      is
      select eage from emp for update;
    begin
      open emp_cur;
      loop
      fetch emp_cur into v_eage;
      exit when emp_cur%notfound;
        
      if v_eage=50 then
      update emp set esal=esal+200 where current of emp_cur;
      else
      update emp set esal=esal+300 wher current of emp_cur;
      end if;
      end loop;
      close emp_cur;
    end;
      

  2.   

    update emp set esal=esal+300 where current of emp_cur;