variable scope with nested block
SQL>
SQL> declare
2 l_parent_number number;
3 begin
4
5 l_parent_number := 1;
6
7 declare
8 l_child_number number := 2;
9 begin
10
11 dbms_output.put_line('parent + child = ' ||
12 to_char(l_parent_number + l_child_number));
13 end;
14
15
16 l_child_number := 2;
17 end;
18 /
l_child_number := 2;
*
ERROR at line 16:
ORA-06550: line 16, column 5:
PLS-00201: identifier 'L_CHILD_NUMBER' must be declared
ORA-06550: line 16, column 5:
PL/SQL: Statement ignored
SQL>
Related examples in the same category