in reply to Template::Plugin::DBI, Oracle and cursors

You can define a cursor, then in a loop:

We do this all the time in our PL/SQL code.

--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee

  • Comment on Re: Template::Plugin::DBI, Oracle and cursors

Replies are listed 'Best First'.
Re^2: Template::Plugin::DBI, Oracle and cursors
by holli (Abbot) on Aug 30, 2005 at 12:53 UTC
    It seems I am not able to grok what that has to do with my problem. I am not using PL/SQL nor is this possible with the Template Toolkit.


    holli, /regexed monk/

      Every time you do a query Oracle internally uses a cursor to retrieve your data.

      If you open lots of statement handles you will get a cursor for each one. It looks like you are doing the query inside a loop so it is opening a new cursor each time around for each query.

      Generally to avoid this you should just prepare your query once outside the loop and close your statement handles after use. If you don't close your statement handle you will end up with a lot of open cursors hanging around

      Of course if you have sys access you can also just raise the open cursor limit if you have the memory;).