[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dbi-dev
Subject:    Re: DBD::Oracle: closing bound cursors
From:       Tim Bunce <Tim.Bunce () ig ! co ! uk>
Date:       1999-07-31 20:10:21
[Download RAW message or body]

    *** From dbi-users -- To unsubscribe, see the end of this message. ***

On Sat, Jul 31, 1999 at 08:15:16PM +0300, Jukka Suomela wrote:
> 
> I've successfully used the cursor binding with DBD::Oracle (as
> documented on the DBD::Oracle manual page, section "Binding Cursors").
> The problem is that I haven't found a way to close the cursor.
> 
>     for my $i (1..100) {
> 	my $sth = $dbh->prepare(
> 	    "BEGIN OPEN :cursor FOR SELECT 123 FROM dual; END;"
> 	);
> 	my $cursor;
> 	$sth->bind_param_inout(
> 	    ":cursor", \$cursor, 0,
> 	    { ora_type => DBD::Oracle::ORA_RSET }
> 	);
> 	$sth->execute();
> 	$sth->finish();
> 
> 	my(@data) = $cursor->fetchrow_array();
> 	$cursor->finish();
> 
> 	print "fetched: $data[0]\n";
>     }
> 
> Running this script gives the following error:
> 
>     DBD::Oracle::st execute failed: ORA-01000: maximum open cursors
>     exceeded
> 
> As you can see, calling $cursor->finish doesn't close the cursor.

It never would. That's not what finish does.

> Even $cursor->DESTROY doesn't do the trick.

DESTROY should be called automatically at the end of each loop anyway.

> Any solutions?

I'll look into it. Thanks for the test case.

Tim.

------------------------------------------------------------------------------
To unsubscribe from this list, please visit: http://www.isc.org/dbi-lists.html
If you are without web access, or if you are having trouble with the web page,
please send mail to dbi-users-request@isc.org with the subject line of
'unsubscribe'.
------------------------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic