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: CURSOR QUESTION

Re: CURSOR QUESTION

From: Erik <ecotsonas_at_saraswati.com>
Date: Mon, 14 Jun 1999 16:00:25 GMT
Message-ID: <7k38uh$s9p$1@nnrp1.deja.com>


In article <7k32so$po6$1_at_nnrp1.deja.com>,   yarch_at_hotmail.com wrote:
> Help!!
> Can I 'reset' a cursor to the beginning? Currently
> I open the cursor and fetch....I need to go back to the beginning
> and loop thru it again.
> Thanks
> Mike
> yarch_at_hotmail.com
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>

The short answer is no you cannot 'reset' a cursor. The long answer is this:
1) determine how much data will be returned by your cursor 2) determine the length of time your cursor will take to execute

One option would be to close and re-open the cursor depending on 1 and 2 above. The sql will be in the parsed cache and depending on the volume of data it too may already be in cache. The drawback is that if you are in a transactional system where a change might occur between the time you process the first cursor and the time you open it the second time.

The other option is to process the cursor the first time and put the results into a pl/sql table. Once it is in a pl/sql table you can process it just like an indexed array (e.g. go back to the begining or any n'th record).

Hope this helps,
Erik

--
Consultant
Saraswati Systems Corporation - (SSC)

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Mon Jun 14 1999 - 11:00:25 CDT

Original text of this message

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