当前位置: 代码迷 >> SQL >> [PL/SQL] WHERE CURRENT OF范例
  详细解决方案

[PL/SQL] WHERE CURRENT OF范例

热度:21   发布时间:2016-05-05 11:04:38.0
[PL/SQL] WHERE CURRENT OF实例
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;

?

  相关解决方案