8. SQL Statements : UPDATE : Embedded Usage
 
Share this page                  
Embedded Usage
Host language variables can only be used within expressions in the SET clause and the search_condition. (Variables used in search_conditions must denote constant values and cannot represent names of database columns or include any operators.) A host string variable can also replace the complete search condition, as when it is used with the Ingres forms system query mode.
The non-cursor update can be formulated as a repeated query by using the keyword repeated. Doing so reduces the overhead required to run the same update repeatedly within your program. The repeated keyword directs the DBMS Server to save the query execution plan when the update is first executed.
This encoding can account for significant performance improvements on subsequent executions of the same update. The repeated keyword is available only for non-cursor updates; it is ignored if used with the cursor version. Repeated update cannot be specified as a dynamic SQL statement.
If your statement includes a dynamically constructed search_condition, that is, if the complete search_condition is specified by a host string variable, do not use the repeated option to change the search_condition after the initial execution of the statement. The saved execution plan is based on the initial value of the search_condition and any changes to search_condition are ignored. This rule does not apply to simple variables used in search_conditions.