First page Back Continue Last page Overview Graphics
…Bind Variable “Peeking”
Subsequent query executions use same plan
Can be bad if different bind variable value(s) warrant different plan
Use literals if this situation is possible
Notes:
Warning: If the next invocation of this query used a different and more selective value for the bind variable, the query would not be re-hard parsed (unless the cursor was flushed from the cache); thus, a full table scan would be used when a index access should be used!
Oracle’s thinking on this is if the values in the bind variables would have caused Oracle to choose a different plan, you should not use bind variables. In this situation, use literals instead.