Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Anju.

Asked: March 23, 2017 - 5:15 pm UTC

Last updated: March 25, 2017 - 3:34 am UTC

Version: 11.2.0.1

Viewed 1000+ times

You Asked

Hello Experts,

As per my understanding, cursors cached in pl/sql cache of an anonymous Pl/SQL block are closed after execution of the block so that next execution requires library cache to be visited to confirm the presence and validity of the cursor at the location pointed to by the pointer in session cache. This causes soft parse.
On the other hand, cursors cached in pl/sql cache of a Pl/SQL block which is part of a stored procedure are kept open after execution of the block so that next execution does not require a visit to library cache for authentication. As a result soft parse is avoided.

Kindly let me know if I understand correctly

Thanks in advance
Regards
Anju Garg

and Connor said...

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Anju Garg, March 24, 2017 - 4:51 am UTC


session cursor caching

Anju Garg, March 24, 2017 - 5:14 am UTC

Thanks Connor for prompt reply. I have another doubt.

Can open cursors cached in pl/sql cache somehow cause fragmentation in shared pool?

Regards
-
Connor McDonald
March 25, 2017 - 3:34 am UTC

We're keeping more cursors open...which means they wont be flushed out of the shared pool...which if the shared pool was *really stressed* might be an issue.

But in my experience, if session cached cursors causes you shared pool problems...you already had a shared pool problems in the first place :-)

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library