The DML Array feature improves application performance by allowing iterative requests to be grouped together into a single step, resulting in a decrease of the step-processing overhead per request. Only single INSERT statements and references to arrays of variables are supported. References to arrays of structures are not supported.
To accommodate this feature, the EXEC SQL statement is modified to:
EXEC SQL FOR (<countval) <sql statement string>;
where:
FOR
indicates that this is an array statement
Note: Ensure that <countval> does not exceed the smallest defined dimension in the list of arrays. An error is generated if this condition is violated and countval is specified as a literal. At precompile time, no check is made when countval is specified as a variable.
Example
DCL EMPNUM(6) BIN FIXED(31);
DCL MGRNUM (6) BIN FIXED(31);
EXEC SQL
PREPARE EXINSERT01 FROM INSERT INTO EMPLOYEE VALUES (?, ?, ?);
EXEC SQL FOR 2
EXECUTE INSSTMT USING :EMPNUM, :MGRNUM;