The scope test script : Variable Scope « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL> <<a>>
  2  declare
  3    x char(1) := 'a';
  4    y char(1) := 'a';
  5  begin
  6     dbms_output.put_line('loop a: x = ' || x);
  7     dbms_output.put_line('loop a: y = ' || y);
  8     <<b>>
  9     declare
 10       x char(1) := 'b';
 11     begin
 12       dbms_output.put_line('loop b: x = ' || x);
 13       dbms_output.put_line('loop b: a.x = ' || a.x);
 14       dbms_output.put_line('loop b: y = ' || y);
 15       dbms_output.put_line('loop b: a.y = ' || a.y);
 16     end b;
 17  end a;
 18  /
loop a: x = a
loop a: y = a
loop b: x = b
loop b: a.x = a
loop b: y = a
loop b: a.y = a

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>








21.37.Variable Scope
21.37.1.Variable visibility
21.37.2.Variable scope
21.37.3.The scope test script