When debugging an implicit cursor loop in a test window some steps are shown erroneously.
Ex.
DECLARE
i PLS_INTEGER := 0;
BEGIN
FOR sor IN (SELECT 1 FROM DUAL
UNION
SELECT 2 FROM DUAL) LOOP
IF i = 0 THEN
DBMS_OUTPUT.PUT_LINE('A') ;
ELSE
DBMS_OUTPUT.PUT_LINE('B') ;
i := i +1;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('i='||i);
END;
The debugger - before taking the the next value and before leaving the loop - stops on the i := i +1; statement, without executing it.
It seems the debugger allways stops on the last statement in the loop before moving on to the correct statement.
Ex.
DECLARE
i PLS_INTEGER := 0;
BEGIN
FOR sor IN (SELECT 1 FROM DUAL
UNION
SELECT 2 FROM DUAL) LOOP
IF i = 0 THEN
DBMS_OUTPUT.PUT_LINE('A') ;
ELSE
DBMS_OUTPUT.PUT_LINE('B') ;
i := i +1;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('i='||i);
END;
The debugger - before taking the the next value and before leaving the loop - stops on the i := i +1; statement, without executing it.
It seems the debugger allways stops on the last statement in the loop before moving on to the correct statement.