Developing Portable Applications : Achieving Transparency and Portability : Repeated Queries
 
Share this page                  
Repeated Queries
If you are issuing a statement in an embedded OpenSQL program more than once, you can improve gateway performance significantly by using repeated queries. Repeated queries allow the gateway to pre-define query definitions and retain these definitions and their host DBMS query plans across database transactions. The entire text of the repeat query is sent to the gateway once. After that, it is simply invoked. A prepared statement is retained until the session ends or the gateway directs the host to release the prepared statement. As a result, repeat queries can reduce both host processing time and gateway communication overhead.
You can use program variables with a repeated query statement just as you would with a regular query statement. The variables are evaluated each time the statement is executed.
You can create repeated queries with the following OpenSQL statements:
select (regular, singleton, or loop)
insert
update (non-cursor)
delete (non-cursor)