* Scope: Lifetime <= 변수는 선언된 블럭 내 존재하고 블럭을 빠져나가면 소멸


  * Visibility: Accessibility without help



<<amu>>      --> qualifier (한정어)

DECLARE

 father_name VARCHAR2(20) := 'Patrick';

 date_of_birth DATE := '20-Apr-1972';

BEGIN

DECLARE

 child_name VARCHAR2(20) :='Mike';

 date_of_birth DATE :='12-Dec-2002';


BEGIN



 DBMS_OUTPUT.PUT_LINE('Father''s Name: '||father_name);

 DBMS_OUTPUT.PUT_LINE('Date of Birth:  '||amu.date_of_birth);

 DBMS_OUTPUT.PUT_LINE('Child''s Name:  '||child_name);

 DBMS_OUTPUT.PUT_LINE('Date of Birth:  '||date_of_birth);

END;



DBMS_OUTPUT.PUT_LINE('Date of Birth: '||date_of_birth);

END;

/



- scope at ①: amu.father_name, amu.date_of_birth, chid_name, date_of_birth

  ②: amu.fatehr_name, amu_date_of_birth


- visibility at ①: amu.father_name, amu.date_of_birth, chid_name, date_of_birth

②: amu.father_name, amu.date_of_birth



  * scope를 벗어나면 변수는 메모리에서 제거됨

+ Recent posts