<<outer>>
DECLARE
sal NUMBER(7,2) := 60000;
comm NUMBER(7,2) := sal * 0.20;
message VARCHAR2(255) := ' eligible for commission';
BEGIN
DECLARE
sal NUMBER(7,2) := 50000;
comm NUMBER(7,2) := 0;
total_comp NUMBER(7,2) := sal + comm;
BEGIN
message := 'CLERK not'||message;
outer.comm := sal * 0.30;
p(message); --> 1. CLERK not eligible for commission
p(comm); --> 2. 0
p(outer.comm); --> 3. 15000
END;
message := 'SALESMAN and '||message;
/*
p(total_comm); --> 4. 에러, ORA-06550
*/
p(comm); --> 5. 15000
p(message); --> 6. SALESMAN and CLERK not eligible for commission
END;
/
'Oracle > PL/SQL' 카테고리의 다른 글
15일차 # 3-20: Make code maintenance easier (0) | 2012.04.24 |
---|---|
15일차 # 3-18: PL/SQL의 연산자 (0) | 2012.04.24 |
15일차 # 3-14: Scope and Visibility (0) | 2012.04.24 |
15일차 # 3-12: Nested Blocks (0) | 2012.04.24 |
15일차 # 3-9: Data Type Conversion (0) | 2012.04.24 |