OPEN USING followed by FOREACH
In earlier versions of IBM®
Informix® 4GL (I4GL),
the
FOREACH
instruction had no a USING
clause
to pass SQL parameters to the prepared statement. SQL Parameters
could be specified in a OPEN USING
instruction, and
were re-used by the next FOREACH
instruction:PREPARE st1 FROM "SELECT * FROM tab WHERE col>?"
DECLARE cu1 CURSOR FOR st1
OPEN cu1 USING var
FOREACH cu1 INTO rec.*
DISPLAY rec.*
END FOREACH
This feature is supported by Genero Business Development Language,
but can lead to defects with some versions of the Informix database client. Review your
code to avoid the OPEN
statement by moving the USING
clause to the FOREACH
instruction.