Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Block Query Slow
Brijesh, the two queries are not actually the same query. One is using
bind variables (pl/sql variables) while the other is using constants.
It is very likely the CBO is developing different plans for the two
versions since it has the actual constant values in one case and
unknown values in the other.
Run an explain plan on both versions. You can use :var1, :v2 to represent bind variables in explain plan.
Also the pl/sql version is processing each and every row in the cursor while the straight query just returns the entire row set. This is a very significant difference in the two statements.
Explain plans for each version of the query may allow someone to provide useful advice.
HTH -- Mark D Powell -- Received on Mon Aug 15 2005 - 16:03:04 CDT