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

From: Michael A Chase tech (mchase_at_ix.netcom.com)
Date: 03/17/05


Date: Wed, 16 Mar 2005 18:25:42 -0800
To: Charles Jardine <cj10@cam.ac.uk>

On 03/16/2005 08:25 AM, Charles Jardine said:

> 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?

It frees the client side handle, but probably doesn't tell the RDBMS
that the cursor is no longer needed.

-- 
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.


Relevant Pages

  • Re: add a new range partition in a existing table
    ... i want add a new range partition in a existing table? ... CURSOR context_date_cur IS ... Where in any Oracle doc did you ever see double quotes like this? ... And what about this requires PL/SQL or a CURSOR LOOP? ...
    (comp.databases.oracle.misc)
  • RE: Oracle cursor help
    ... I have a PL/SQL process that I use to purge rows from a table ... Even though it's PL/SQL, ... Define SQL statement to gather the rows (PL/SQL cursor); ... DELETE/WHERE clauses consume too many resources. ...
    (perl.dbi.users)
  • Re: oracle leaving open cursors...
    ... > We have a database driven servlet/jsp application with Oracle as backend. ... > What exactly is a cursor after I hav used it? ... > when I close the connection, or do I always have to close the cursor ... & "returnacursor" is a pl/sql subroutine that returns a cursor,then you ...
    (comp.lang.java.programmer)
  • PL/SQL
    ... Ich habe mich in den letzten Tagen in PL/SQL eingelesen, ... Jede SELECT Abfrage wird intern als temporäre Tabelle ... Wann genau brauche ich einen Cursor, bzw. wann brauche ich ihn nicht? ... Ohne Cursor muss man ein SELECT schreiben, dass nur genau eine Zeile zurückgibt. ...
    (de.comp.datenbanken.misc)