<샘플코드에서 사용한 데이터는 HR 스키마이고, 오라클 설치시 생성할 수 있는 기본 스키마 입니다>
# c_var1/c_var2 can be referenced any place in package body
# c_var3 can be referenced any place in package body
# c_var4 can be referenced only in print procedure
create or replace package p_test
is
c_var1 constant number:=10;
c_var2 varchar2(100):='welcome';
procedure print;
end;
/
create or replace package body p_test
is
c_var3 varchar2(100):='hi there';
procedure print
is
c_var4 varchar2(100):='hi';
begin
dbms_output.put_line('this variable came from package spec. '||c_var1);
dbms_output.put_line('this variable came from package spec. '||c_var2);
dbms_output.put_line('this variable came from package body. '||c_var3);
dbms_output.put_line('this variable came from print proced. '||c_var4);
end;
end;
/
execute p_test.print;
---------------------------------------------------------------
this variable came from package spec. 10
this variable came from package spec. welcome
this variable came from package body. hi there
this variable came from print proced. hi
'Database > PLSQL' 카테고리의 다른 글
050 - [Oracle PL/SQL] Package - Overloading (procedures) (0) | 2024.03.06 |
---|---|
049 - [Oracle PL/SQL] Package - recompile the package (0) | 2024.02.28 |
047 - [Oracle PL/SQL] Package - guidelines for packages (0) | 2024.02.28 |
046 - [Oracle PL/SQL] Package - without body (0) | 2024.02.28 |
045 - [Oracle PL/SQL] Package - Sample (0) | 2024.02.27 |