Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can i change the content of a cursor on a loop?

Like:

SQL
DECLARE
 Cursor c;
 id int;
BEGIN
LOOP
    --Initialize cursor with similar query but distict where using the id variable.
    --Cursor loop to process data
END LOOP
END;
Posted

Try using WHERE CURRENT OF, please see the example here:

http://www.techonthenet.com/oracle/cursors/current_of.php[^]
 
Share this answer
 
I was thinking about change the cursor, not the table using cursor.
I got this solution:

CSS
DECLARE
 id int;
BEGIN
LOOP
    -- id = new_value;
    FOR X IN (SELECT * FROM T WHERE T.ID = ID)
    LOOP
         -- Process data.
    END LOOP;
END LOOP;
END;
 
Share this answer
 
Comments
Sudhakar Shinde 17-May-13 1:51am    
You did not give your requirement clearly in the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900