Non-Cursor Delete
The non-cursor version of the embedded OpenSQL DELETE statement is identical to the interactive delete. Host language variables can be used to represent constant expressions in the search_condition but they cannot specify names of database columns or include any operators. The complete search condition can be specified using a host string variable.
To reduce the overhead required to execute a (non-cursor) delete repeatedly, specify the keyword REPEATED. The REPEATED keyword directs the OpenSQL to encode the delete and save its execution plan the first time the statement is executed, thereby improving subsequent executions of the same delete. The REPEATED keyword is valid for non-cursor deletes only and is ignored if used with the cursor version of the statement. The repeated delete cannot be specified as a dynamic OpenSQL statement.
If the search_condition is dynamically constructed and the search_condition is changed after initial execution of the statement, the REPEATED option cannot be specified. The saved execution plan is based on the initial values in the search_condition and changes are ignored. This rule does not apply to simple variables used in search_conditions.
Last modified date: 08/28/2024