Oracle Error PLS-00440: FORALL bulk IN-bind variables cannot be used here

Oracle Error Message

PLS-00440: FORALL bulk IN-bind variables cannot be used here

Reason for the Error

A reference to a FORALL statement’s bulk IN-bind variable was found in a context in which it is not permitted. For example, such variables are not permitted in expressions in the USING clause of a dynamic SQL statement: forall j in 1..Users.Count() execute immediate ‘ insert into System_Users(Username) values :U’ using Upper(Users(j));

Solution

In the case described above, move the expression from the USING clause into the SQL statement: forall j in 1..Users.Count() execute immediate ‘ insert into System_Users(Username) values Upper(:U)’ using Users(j);