This question is just out of curiosity. I am trying to find out what happens when no exit condition is specified for a cursor. What happens after last record is fetched. Will the cursor point to first record or point to blank memory area? For this I have created a test table with below structure.
create table CURSOR_TEST
(col1 number,col2 NUMBER
);
and below is my anonymous block without exit condition
declare
cursor CUR is select EMPNO from EMP;
v1 number;
begin
open CUR;
loop
fetch CUR into V1;
insert into CURSOR_TEST values(s.nextval,V1);
commit;
end loop;
close CUR;
end;
As it is infinite loop, I need to break the operation in between. After this when I check records in the table I could see that after all rows of emp are fetched, the cursor points to first row again but fetching doesn't seem to happen after this. I could not understand why cursor is not able to fetch the second and subsequent rows during second iteration of the table.