CREATE OR REPLACE PROCEDURE bulk_exceptions (whr_in IN VARCHAR2 := NULL) IS TYPE numlist_t IS TABLE OF NUMBER; TYPE namelist_t IS TABLE OF VARCHAR2 (100); enames_with_errors namelist_t := -- Max of 10 characters in emp. namelist_t ('LITTLE', 'BIGBIGGERBIGGEST', 'SMITHIE', ''); bulk_errors EXCEPTION; PRAGMA EXCEPTION_INIT ( bulk_errors, -24381 ); BEGIN FORALL indx IN enames_with_errors.FIRST .. enames_with_errors.LAST SAVE EXCEPTIONS EXECUTE IMMEDIATE 'UPDATE emp SET ename = :newname' USING enames_with_errors(indx); EXCEPTION WHEN bulk_errors THEN FOR indx IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP DBMS_OUTPUT.PUT_LINE ( 'Error ' || indx || ' occurred during ' || 'iteration ' || SQL%BULK_EXCEPTIONS(indx).ERROR_INDEX || ' updating name to ' || enames_with_errors(SQL%BULK_EXCEPTIONS(indx).ERROR_INDEX)); DBMS_OUTPUT.PUT_LINE ( 'Oracle error is ' || SQLERRM(-1 * SQL%BULK_EXCEPTIONS(indx).ERROR_CODE)); END LOOP; END; / /*====================================================================== | Supplement to the third edition of Oracle PL/SQL Programming by Steven | Feuerstein with Bill Pribyl, Copyright (c) 1997-2002 O'Reilly & | Associates, Inc. To submit corrections or find more code samples visit | http://www.oreilly.com/catalog/oraclep3/ */