Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ref cursor is slower than issuing the same query directly

533958May 16 2007 — edited May 17 2007
We are building SQL dynamically in PL/SQL procedure. SQL is complex enough (pivoting, UNIONS, spatial operations, complex underlying view joining many tables). Then we are opening ref cursor output parameter using the following syntax:

OPEN p_cursor FOR v_sql using p_param1, p_param2;

Then client code iterates through the rows of the cursor. It takes about a minute. If we run the SQL stored in v_sql variable directly in SQL Plus (replacing bind variables with values of course), we get 4 seconds response time.

QUESTION: what makes ref cursor being so slow comparing with direct execution of the same query?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2007
Added on May 16 2007
16 comments
2,029 views