PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND table of records
I found this on the web there is workaround for above error
--
-- Create an object and collection to define a set of rows to update with...
--
CREATE TYPE emp_ot AS OBJECT
( empno NUMBER(4)
, ename VARCHAR2(10)
, sal NUMBER(7,2)
);
/
CREATE TYPE emp_ntt AS TABLE OF emp_ot;
/
--
-- Now we'll fetch a collection of EMP records and then perform a FORALL
-- UPDATE referencing some of the attributes in each record of the
-- collection (usually restricted)...
--
DECLARE
nt_emp emp_ntt;
BEGIN
/* Populate the demo collection... */
SELECT emp_ot(empno, ename, sal) BULK COLLECT INTO nt_emp
FROM emp;
/* FORALL with workaround... */
FORALL i IN nt_emp.FIRST .. nt_emp.LAST
UPDATE emp
SET ename = TREAT( nt_emp(i) AS emp_ot ).ename
, sal = TREAT( nt_emp(i) AS emp_ot ).sal * 1.1
WHERE empno = TREAT( nt_emp(i) AS emp_ot ).empno;
DBMS_OUTPUT.PUT_LINE(
TO_CHAR( SQL%ROWCOUNT ) || ' rows updated.'
);
END;
/
spool off
--
-- Cleanup...
--
DROP TYPE emp_ot FORCE;
DROP TYPE emp_ntt FORCE;
this worked for me and you can find the oringinal authors
http://mysite.wanadoo-members.co.uk/adriansoraclepages/demos/10g/scripts/forall_restriction_workaround.sql Original author goes by the name of Mr.James Padfield.