Bind Variables and Execute Immediate
Bind Variables and Execute Immediate
Bind Variables and Execute Immediate
For each SQL submitted, Oracle picks the execution plan from shared pool
if same exact SQL already exists there, which is called soft parsing. If
the SQL submitted is not found in Shared Pool, Oracle has to do the hard
parsing which is SQL statement needs to be checked for syntax and
semantics errors, and generating various execution plans to find and
select optimal one. Hard parsing is very CPU intensive.
Now my favourite part, lets code and check performance benefits of bind
variables.
SQL> commit;
Commit complete.
All good, we have created a table with 99999 records and we have an index
on it. Lets run plsql block executing 99999 queries without bind
variable.
Lets now try same code with bind variables on the same data