The query parameters (described in Query Parameters) are evaluated when the query is parsed. For repeat queries, this occurs when the query is defined, which means the values will be fixed at execution time, regardless of the values sent when executed.
Repeat query parameters that take on unique values at execution time are possible using an extension to the query parameter mechanism described in Query Parameters. These extended parameter markers take the form:
$n = ~V
where n is replaced by sequentially increasing integers starting with 0.
The query from the previous section, if used as a repeat query would be:
select * from employee where dept = $0 = ~V and age > $1 = ~V
When implementing repeat queries, parameter values must be sent when the repeat query is defined, as well as when the query is invoked. Query text is not sent when a repeat query is invoked, but the parameters sent at invocation must be in the same order as when the repeat query was defined.