Sample code:
set serveroutput on;
declare
begin
for p in (select 123 id from dual union select 324 from dual)
loop
dbms_output.put_line('value ' || p || 'is:' || p.id);
end loop;
end;
/
Expected output:
Value 1 is: 123
Value 2 is: 324.
Is there any other way apart from increasing local defined variable value, one by one inside the loop for each iteration. ( Do not use this logic : for p in (query) loop i := i+1; print value , end loop). I am expecting some other mechanism