CREATE OR REPLACE PROCEDURE WHERE_CURRENTIS CURSOR EMP_LIST IS SELECT EMPNO , ENAME , SAL FROM EMP WHERE EMPNO = 1000 FOR UPDATE; BEGIN DBMS_OUTPUT.ENABLE; DBMS_OUTPUT.PUT_LINE('***** 更新操作 *****'); FOR EMPLIST IN EMP_LIST LOOP UPDATE EMP SET JOB = 'PM' , SAL = 1000 WHERE CURRENT OF EMP_LIST; DBMS_OUTPUT.PUT_LINE('***** 修改完成 *****'); END LOOP; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERR CODE : ' || TO_CHAR(SQLCODE)); DBMS_OUTPUT.PUT_LINE('ERR MESSAGE : ' || SQLERRM); END WHERE_CURRENT;
?