Use a read only transaction.
Here's an example.
Jared
---------------
drop table datetab;
create table datetab ( cdate date );
begin
for i in 1..10
loop
insert into datetab values(sysdate);
end loop;
end;
/
commit;
exec dbms_lock.sleep(1)
declare
cursor cDate
is
select cdate
from datetab;
i pls_integer;
procedure addrow
is
pragma autonomous_transaction;
begin
insert into datetab values(sysdate);
commit;
end;
begin
commit;
set transaction read only;
i := 0;
for rec in cDate
loop
dbms_output.put_line(rec.cdate);
i := i + 1;
end loop;
dbms_output.put_line('counter: ' || i );
addrow;
i := 0;
for rec in cDate
loop
dbms_output.put_line(rec.cdate);
i := i + 1;
end loop;
dbms_output.put_line('counter: ' || i );
commit;
end;
/
select * from datetab;
Andrea Oracle
<andreaoracle@ To: Multiple recipients of list ORACLE-L
<[EMAIL PROTECTED]>
yahoo.com> cc:
Sent by: Subject: copy cursor ???
[EMAIL PROTECTED]
om
10/01/01 03:55
PM
Please respond
to ORACLE-L
Hi, all
Is there a way to clone/copy a cursor? I have a
cursor, after looping throught it, I would like to go
to the beginning and loop again. If I open the cursor
again, my impression is that the cursor does a new
select, which might not return the exact same rows as
before, since the data got changed all the time. If I
open the cursor twice in delcare section, the two
cursor might not be the same, since it took about 3
minutes to do the select. So how can I work on two
EXACTLY same copies of the cursor? Thank you!
Andrea
__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Andrea Oracle
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).