create or replace procedure relation(tname varchar2) is
begin
FOR I IN (SELECT * FROM sys.dba_triggers) LOOP
IF INSTR(I.TRIGGER_BODY, LOWER(tname)) > 0 OR INSTR (I.TRIGGER_BODY, UPPER(tname)) > 0 THEN
INSERT INTO TABLE_RELATED VALUES (UPPER(tname),I.TRIGGER_NAME,1,'');
END IF;
DELETE FROM TABLE_RELATED A WHERE A.ROWID > (SELECT MIN(B.ROWID) FROM TABLE_RELATED B WHERE A.TABLE_NAME = B.TABLE_NAME AND A.RELATED_NAME = B.RELATED_NAME AND A.RELATED_TYPE = 1 );
COMMIT;
END LOOP;
FOR K IN (SELECT * FROM sys.all_source WHERE sys.all_source.type = 'PROCEDURE' AND sys.all_source.owner NOT LIKE ('%SYS%')) LOOP
IF INSTR(K.TEXT, LOWER(tname)) > 0 OR INSTR(K.TEXT,UPPER(tname)) > 0 THEN
INSERT INTO TABLE_RELATED VALUES (UPPER(tname),K.NAME,3,'');
END IF;
DELETE FROM TABLE_RELATED A WHERE A.ROWID > (SELECT MIN(B.ROWID) FROM TABLE_RELATED B WHERE A.TABLE_NAME = B.TABLE_NAME AND A.RELATED_NAME = B.RELATED_NAME AND A.RELATED_TYPE = 3 );
COMMIT;
END LOOP;
end;
分享到:
------解决方案--------------------
有表啊,除非你用了动态SQL,一般肯定会显示的
select * from DBA_DEPENDENCIES where REFERENCED_NAME='...'