Multiple Block handling in PL/SQL

This example will demonstrate the performance of different blocks. The golden rule is followed – first inner, then outer

<> — Block Name
DECLARE
X NUMBER;
BEGIN
X:=1;
WHILE X<5
LOOP
DBMS_OUTPUT.PUT_LINE (X);
<> –Block Name
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;

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>