是否可以编写PL/SQL查询来识别存储过程依赖项的完整列表?我只对识别其他存储过程感兴趣,而且我也不想限制嵌套的深度.例如,如果A调用B,调用C,调用D,我希望B,C和D报告为A的依赖.
在此页面上,您将找到以下使用PUBLIC_DEPENDENCY字典表的查询:
SELECT lvl , u.object_id , u.object_type , LPAD (' ', lvl) || object_name obj FROM ( SELECT LEVEL lvl, object_id FROM SYS.public_dependency s START WITH s.object_id = ( SELECT object_id FROM user_objects WHERE object_name = UPPER ('&OBJECT_NAME') AND object_type = UPPER ('&OBJECT_TYPE')) CONNECT BY s.object_id = PRIOR referenced_object_id GROUP BY LEVEL, object_id) tree , user_objects u WHERE tree.object_id = u.object_id ORDER BY lvl /