본문 바로가기

Database/PLSQL

113 - [Oracle PL/SQL] Dependencies - Impact on the Package

  • 테스트용 패키지와 프로시져 생성
create or replace package pkg
is
    procedure p1;
end;
/
create or replace package body pkg
is
    procedure p1
    is
    begin 
        dbms_output.put_line ('welcome');
    end;
end;
/

--프로시져에서 패키지.프로시져 호출
create or replace procedure call_from_pkg
is
begin
    pkg.p1;
end;


select object_name, object_type, created, status
from user_objects
where lower(object_name) in ('pkg','call_from_pkg');
----------------------------------------------------
/*
OBJECT_NAME                    OBJECT_TYPE             CREATED   STATUS 
------------------------------ ----------------------- --------- -------
CALL_FROM_PKG                  PROCEDURE               20-MAY-24 VALID  
PKG                            PACKAGE                 20-MAY-24 VALID  
PKG                            PACKAGE BODY            20-MAY-24 VALID 
*/

 

 

 

  • 패키지 내부의 프로시져 수정 - 패키지를 호출 프로시져의 상태는 정상
create or replace package body pkg
is
    procedure p1
    is
    begin 
        dbms_output.put_line ('welcome');
        if 1=1 then
        dbms_output.put_line ('yes');
        end if;
    end;
end;



select object_name, object_type, created, status
from user_objects
where lower(object_name) in ('pkg','call_from_pkg');
----------------------------------------------------
/*
OBJECT_NAME                    OBJECT_TYPE             CREATED   STATUS 
------------------------------ ----------------------- --------- -------
CALL_FROM_PKG                  PROCEDURE               20-MAY-24 VALID  
PKG                            PACKAGE                 20-MAY-24 VALID  
PKG                            PACKAGE BODY            20-MAY-24 VALID 
*/

 

 

 

  • 패키지에 프로시져 추가 - 패키지를 호출 프로시져의 상태는 정상(새로운 프로시져이므로 영향 없음)
create or replace package pkg
is
    procedure p1;
    procedure p2;
end;
/
create or replace package body pkg
is
    procedure p1
    is
    begin 
    dbms_output.put_line ('welcome');
    end;
    
    procedure p2
    is
    begin 
    dbms_output.put_line ('welcome');
    end;
end;



select object_name, object_type, created, status
from user_objects
where lower(object_name) in ('pkg','call_from_pkg');
----------------------------------------------------
/*
OBJECT_NAME                    OBJECT_TYPE             CREATED   STATUS 
------------------------------ ----------------------- --------- -------
CALL_FROM_PKG                  PROCEDURE               20-MAY-24 VALID  
PKG                            PACKAGE                 20-MAY-24 VALID  
PKG                            PACKAGE BODY            20-MAY-24 VALID 
*/