Oracle/PL_SQL2009. 11. 16. 17:57
테이블 변경시에 관련된 프로시져를 확인하는 방법

anonymous procedure, function, package는 확인할 방법이 없고,
이름이 있는 procedure, function, package는 아래와 같이 확인


select *
from user_dependencies
where REFERENCED_NAME = 'EMP';


NAME TYPE REFERENCED_OWNER REFERENCED_NAME REFERENCED_TYPE REFERENCED_LINK_NAME SCHEMAID DEPENDENCY_T
PROC1 PROCEDURE HR06 EMP TABLE   66 HARD
EMP_IFO PROCEDURE HR06 EMP TABLE   66 HARD
PACK1 PACKAGE HR06 EMP TABLE   66 HARD
PACK2 PACKAGE HR06 EMP TABLE   66 HARD
PACK_HR_MANAGEMENT PACKAGE HR06 EMP TABLE   66 HARD
PACK_HR_MANAGEMENT PACKAGE BODY HR06 EMP TABLE   66 HARD
UP_EMP_CNT_SUM_SAL PROCEDURE HR06 EMP TABLE   66 HARD
UP_ENAME_SAL_JOB PROCEDURE HR06 EMP TABLE   66 HARD


사용자가 정의한 procedure, function, package확인하는 방법

예)

select *
from user_source
where name = 'PROC1';


NAME TYPE LINE TEXT
PROC1 PROCEDURE 1 procedure proc1
PROC1 PROCEDURE 2 is
PROC1 PROCEDURE 3 v_sum_sal10 number;
PROC1 PROCEDURE 4 v_sum_sal20 number;
PROC1 PROCEDURE 5 begin
PROC1 PROCEDURE 6 select sum(sal) into v_sum_sal10
PROC1 PROCEDURE 7 from emp
PROC1 PROCEDURE 8 where deptno = 10;
PROC1 PROCEDURE 9  
PROC1 PROCEDURE 10 select sum(sal) into v_sum_sal20
PROC1 PROCEDURE 11 from emp
PROC1 PROCEDURE 12 where deptno = 20;
PROC1 PROCEDURE 13  
PROC1 PROCEDURE 14 dbms_output.put_line(chr(10));
PROC1 PROCEDURE 15  
PROC1 PROCEDURE 16 if v_sum_sal10 > v_sum_sal20 then
PROC1 PROCEDURE 17 dbms_output.put_line(10);
PROC1 PROCEDURE 18 elsif v_sum_sal10 < v_sum_sal20 then
PROC1 PROCEDURE 19 dbms_output.put_line(20);
PROC1 PROCEDURE 20 else
PROC1 PROCEDURE 21 dbms_output.put_line('same');
PROC1 PROCEDURE 22 end if;
PROC1 PROCEDURE 23  
PROC1 PROCEDURE 24 end;



'Oracle > PL_SQL' 카테고리의 다른 글

trigger  (0) 2009.11.17
package의 overloading  (0) 2009.11.17
wrap pld  (0) 2009.11.16
Exception handling  (0) 2009.11.13
Cursor  (0) 2009.11.12
Posted by 자수성가한 부자