The function finish() does not actually get rid of the statement handle, in Oracle terms of closing a cursor. Inside of a block, a statement handle is a perl object, so it will continue to exists (and keep its cursor open) while the block its created in still exists. The undef just insures that you won't be able to access the object again.
To fix your problem, I'd try putting all the code related to the cursor in the for loop in an anonymous block (i.e. put {...} around the code). Start the line before the "my $sth_back" and end it after the undef $sth_back. You'll also need to move your initial declaration of $back_links to the top of the function, but you can still set the value in this block. This should force Perl's garbage collection to destroy the statement handles and close the cursors.
Also, placeholders may work to automagically open/close/re-open the cursors for you. If placeholders don't work try what I wrote above.
Hope this helps, Steve

In reply to Re: Oracle Cursors Exceeded by Steve_p
in thread Oracle Cursors Exceeded by timo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.