This example will demonstrate the performance of different blocks. The golden rule is followed – first inner, then outer
<
DECLARE
X NUMBER;
BEGIN
X:=1;
WHILE X<5
LOOP
DBMS_OUTPUT.PUT_LINE (X);
<
DECLARE
X NUMBER;
BEGIN
X:=1;
WHILE X<3
LOOP
DBMS_OUTPUT.PUT_LINE(X||’ ‘||OUTER.X);
X:=X+1;
END LOOP;
END;
X:=X+1;
END LOOP;
END;