The following code labels the outer block with the name outer.
After the sub-block redeclares the global variable birthdate, it can reference that global variable by qualifying its name with the block label.
The sub-block can reference its local variable birthdate via its simple name.
SQL> SQL> <<outer>> -- label 2 DECLARE 3 birthdate DATE := '09-AUG-90'; 4 BEGIN-- from www . java 2s. c o m 5 DECLARE 6 birthdate DATE := '29-SEP-80'; 7 BEGIN 8 DBMS_OUTPUT.PUT_LINE ('birthdate:'|| TO_CHAR(birthdate)); 9 DBMS_OUTPUT.PUT_LINE ('outer.birthdate:'||TO_CHAR(outer.birthdate)); 10 IF birthdate = outer.birthdate THEN 11 DBMS_OUTPUT.PUT_LINE ('Same Birthday'); 12 ELSE 13 DBMS_OUTPUT.PUT_LINE ('Different Birthday'); 14 END IF; 15 END; 16 END; 17 / birthdate:29-09-0080 outer.birthdate:09-08-0090 Different Birthday PL/SQL procedure successfully completed. SQL>