create 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;
/
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;
create or replace procedure p
is
这里应该是AS不是IS吧?