| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.server -> Exception halting a FORALL
From the docs.
"When any execution of the SQL statement raises an exception, the FORALL statement halts."
Is there anyway around that, other than creating a normal loop.
An example:
CREATE TABLE MyTable(MyColumn NUMBER PRIMARY KEY); INSERT INTO MyTable VALUES (2);
CREATE OR REPLACE PROCEDURE MyProc IS
  TYPE  MyType IS TABLE OF NUMBER; 
  MyVar MyType := MyType(1,2,3);
BEGIN FORALL Moo IN 1..3 INSERT INTO MyTable VALUES(MyVar(Moo));
EXCEPTION
  WHEN DUP_VAL_ON_INDEX THEN NULL;
END;
/
EXECUTE MyProc;
SELECT * FROM MyTable;
Because of the PRIMARY KEY violation, 2 is not written, but the FORALL then exists, and 3 never gets a chance.
Brian Received on Thu Nov 22 2001 - 19:31:44 CST
|  |  |