in reply to Re: Oracle Cursors Exceeded
in thread Oracle Cursors Exceeded

Shuffling the code around won't help, and using undef won't destroy the cursor when you use prepare_cached, because DBI will keep a reference to the $sth even if you don't. But I would probably move the prepare_cached from inside the for loop to outside of the loop for a small efficiency gain (so you don't have to refetch the $sth on every iteration of the loop).

Also, you don't need to call finish when you fetch all of the rows from a cursor (it should only be used when you, e.g., fetch the first n rows and then exit the loop early), and you don't need to undef the $sth. And I would be cautious in using the fetchall_* methods; if there are alot of rows it can eat up memory; and if you don't really need the entire result set all at once, you're just as well off just using fetch (maybe even combined with bind_columns).