Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Question about cursors

Re: Question about cursors

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 04 Apr 2002 23:06:07 +0200
Message-ID: <bsfpauc2d5p9i83k6sbogi7n7svskkj8be@4ax.com>


On Thu, 4 Apr 2002 12:39:10 -0500, "Syltrem" <syltremspammenot_at_videotron.com> wrote:

>This is an easy one, but I haven't yet found the answer in the doc (still
>looking)
>
>When is a cursor implicitely closed ?
>
>I can close it explicitely with the CLOSE verb, but does it get closed as
>soon as we exit from the procedure that created/opened it?
>Can we call the procedure in a loop, and each time get, say, the next row
>from that cursor? That's what I would need to do. If that isn't possible
>then I would have to do a select where key > previous_key or something like
>this in that cursor and reopen the cursor every time the procedure is
>called.
>
>Thanks.

Cursors get closed when you leave the procedure. So the answer to your 2nd question is: NO you can't do this.
Instead you should encapsulate the cursor in a package, in the package specification, open it outside your procedure, fetch a record from it each time you call your procedure, and close it outside your procedure.
Not sure I wouldn't consider this messy code (probably I do), but it should work.

Regards

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Thu Apr 04 2002 - 15:06:07 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US