Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can we reset a cursor to first row

707262Jun 22 2009 — edited Jun 23 2009
Hello

Is it possible that we reset a cursor to first row after reaching last row?

I want to do something like this

DECLARE
cur SYS_CURSOR;
queryContext DBMS_XMLGEN.ctxHandle;
result CLOB;

BEGIN
OPEN cur FOR seq.nextval tid, testcol1 FROM testtable;
queryContext := DBMS_XMLGEN.newContext(cur);
result := DBMS_XMLGEN.getXML(queryContext);
DBMS_XMLGEN.closeContext(queryContext);

-- The cursor is at end of record set, I need to go back to first row and insert the data into a table

RESET cur; -- No such command exist, just an idea
LOOP
-- insert each row in table
END LOOP;
CLOSE cur;
END;

I could query again with same select statement if I had not had generated a value from a sequence.

Omer
This post has been answered by Peter Gjelstrup on Jun 23 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2009
Added on Jun 22 2009
15 comments
16,508 views