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: sylvain tremblay <syltrem_at_videotron.ca>
Date: Thu, 4 Apr 2002 20:53:28 -0500
Message-ID: <pt7r8.5588$dX4.403375@weber.videotron.net>


Thanks for the good info.
I can't use your trick to define the cursor in the package, because the caller is not a procedure in the package. This is a tool we use for our website, that calls the code to get 1st 10 rows (and fill up a screen) then get 10 more when user presses Next Page button.

In light of what you`re telling me, I will have to have another parameter holding the key value of the last row returned, and get the next rows based on "where key > last_key". It seems to me that`s the only way to go. If not please explain.

Thanks.
Syltrem

"Sybrand Bakker" <postbus_at_sybrandb.demon.nl> a écrit dans le message de news: bsfpauc2d5p9i83k6sbogi7n7svskkj8be_at_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 - 19:53:28 CST

Original text of this message

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