DBD::Oracle - closing cursors returned from PL/SQL

From: Charles Jardine (cj10_at_cam.ac.uk)
Date: 03/16/05


Date: Wed, 16 Mar 2005 16:25:25 +0000
To:  dbi-users@perl.org

perldoc DBD::Oracle says, under "Binding Cursors":

> To close the cursor you (currently) need to do this:
>
> $sth3 = $dbh->prepare("BEGIN CLOSE :cursor; END;");
> $sth3->bind_param_inout(":cursor", \$sth2, 0, { ora_type => ORA_RSET } );
> $sth3->execute;

This works, and demonstrates that a cursor got from PL/SQL
may be passed back to PL/SQL. However, I doubt that it is
necessary. Tracing shows that, if I let $sth2 go out of scope,
the destructor frees the OCI statement handle. Surely this
will cause the cursor's resources will be released.

Does anyone know why this was once thought to be necessary?

-- 
Charles Jardine - Computing Service, University of Cambridge
cj10@cam.ac.uk    Tel: +44 1223 334506, Fax: +44 1223 334679