Using Deferred-Prepare with OPTOFC
You can use the Deferred-Prepare and Open-Fetch-Close Optimization
(OPTOFC) features in combination. The OPTOFC feature delays sending
the OPEN message to the database server until the FETCH message is
sent. The following situations occur if you enable the Deferred-Prepare
and OPTOFC features at the same time:
- If the text of a prepared statement contains syntax errors, the error messages are not returned to the application until the first FETCH statement is executed.
- A DESCRIBE statement cannot be executed until after the FETCH statement.
- You must issue an ALLOCATE DESCRIPTOR statement before a DESCRIBE or GET DESCRIPTOR statement can be executed.
The database server performs an internal execution of a SET DESCRIPTOR statement which sets the TYPE, LENGTH, DATA, and other fields in the system descriptor area. You can specify a GET DESCRIPTOR statement after the FETCH statement to see the data that is returned.