CREATE TABLE t(x INT);
CREATE VIEW v AS SELECT * FROM t;
CREATE PROCEDURE p
AS
BEGIN
FOR x IN (SELECT * FROM v)
LOOP
NULL;
END LOOP;
END;
/
CREATE OR REPLACE FUNCTION f
RETURN NUMBER
AS
l_cnt NUMBER;
BEGIN
SELECT COUNT(*) INTO l_cnt FROM t;
RETURN l_cnt;
END;
/
SELECT name, type, referenced_name, referenced_type
FROM user_dependencies
WHERE referenced_owner = user
ORDER BY name
;
NAME TYPE REFERENCED_NAME REFERENCED_TYPE
---- ---------- --------------- ---------------
F FUNCTION T TABLE
P PROCEDURE V VIEW
V VIEW T TABLE
SELECT object_name, object_type, status
FROM user_objects
;
OBJECT_NAME OBJECT_TYPE STATUS
----------- ----------- -------
F FUNCTION VALID
P PROCEDURE VALID
T TABLE VALID
V VIEW VALID
ALTER TABLE t ADD y NUMBER;
SELECT object_name, object_type, status
FROM user_objects
;
OBJECT_NAME OBJECT_TYPE STATUS
----------- ----------- -------
F FUNCTION INVALID
P PROCEDURE INVALID
T TABLE VALID
V VIEW INVALID
CREATE PROCEDURE p2
AS
BEGIN
p;
END;
/
SELECT name, type, referenced_name, referenced_type
FROM user_dependencies
WHERE referenced_owner = user
ORDER BY name
;
NAME TYPE REFERENCED_NAME REFERENCED_TYPE
---- ---------- --------------- ---------------
F FUNCTION T TABLE
P PROCEDURE V VIEW
P2 PROCEDURE P PROCEDURE
V VIEW T TABLE
SELECT object_name, object_type, status
FROM user_objects
;
OBJECT_NAME OBJECT_TYPE STATUS
----------- ----------- -------
F FUNCTION INVALID
P PROCEDURE VALID
P2 PROCEDURE VALID
T TABLE VALID
V VIEW VALID
ALTER TABLE t ADD z NUMBER;
SELECT object_name, object_type, status
FROM user_objects
;
OBJECT_NAME OBJECT_TYPE STATUS
----------- ----------- -------
F FUNCTION INVALID
P PROCEDURE INVALID
P2 PROCEDURE INVALID
T TABLE VALID
V VIEW INVALID
DROP PROCEDURE p;
DROP PROCEDURE p2;
DROP FUNCTION f;
CREATE PACKAGE p1
AS
PROCEDURE p;
END;
/
CREATE PACKAGE BODY p1
AS
PROCEDURE p
AS
BEGIN
FOR x IN (SELECT * FROM v)
LOOP
NULL;
END LOOP;
END;
END p1;
/
CREATE PACKAGE p2
AS
PROCEDURE p;
END;
/
CREATE PACKAGE BODY p2
AS
PROCEDURE p
AS
BEGIN
p1.p;
END;
END p2;
/
SELECT name, type, referenced_name, referenced_type
FROM user_dependencies
WHERE referenced_owner = user
ORDER BY name
;
NAME TYPE REFERENCED_NAME REFERENCED_TYPE
---- ------------ --------------- ---------------
P1 PACKAGE BODY V VIEW
P1 PACKAGE BODY P1 PACKAGE
P2 PACKAGE BODY P2 PACKAGE
P2 PACKAGE BODY P1 PACKAGE
V VIEW T TABLE
SELECT object_name, object_type, status
FROM user_objects
;
OBJECT_NAME OBJECT_TYPE STATUS
----------- ------------ -------
P1 PACKAGE VALID
P1 PACKAGE BODY VALID
P2 PACKAGE VALID
P2 PACKAGE BODY VALID
T TABLE VALID
V VIEW VALID
ALTER TABLE t ADD a NUMBER;
SELECT object_name, object_type, status
FROM user_objects
;
OBJECT_NAME OBJECT_TYPE STATUS
----------- ------------ -------
P1 PACKAGE VALID
P1 PACKAGE BODY INVALID
P2 PACKAGE VALID
P2 PACKAGE BODY VALID
T TABLE VALID
V VIEW INVALID
EXEC p2.p;
SELECT object_name, object_type, status
FROM user_objects
;
OBJECT_NAME OBJECT_TYPE STATUS
----------- ------------ -------
P1 PACKAGE VALID
P1 PACKAGE BODY VALID
P2 PACKAGE VALID
P2 PACKAGE BODY VALID
T TABLE VALID
V VIEW VALID
- 강좌 URL : http://www.gurubee.net/lecture/3574
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.