Answers:
DBA_DEPENDENCIES
视图具有此类问题的所有答案。
select * from DBA_DEPENDENCIES
where referenced_owner='HR' and referenced_name='STORED_PROCEDURE_41';
DBA_DEPENDENCIES
向我们展示更多类似如果丢弃特定对象将使之无效的内容。因此,例如,您可以找到引用表的视图。
这似乎有效-比@MindaugasRiauba的回答不太优雅,但似乎确实可以从所有软件包中找到引用。
SELECT * FROM all_source
where UPPER(TEXT) like UPPER('%STORED_PROCEDURE_NAME%')
我也有类似的情况,只是我需要检索使用特定软件包的软件包列表。所以我做了这个查询,也许有帮助:
with dep2 as (
select dep.*
from all_dependencies dep
where dep.owner not in ('SYS', 'SYSTEM', 'PUBLIC', 'XDB')
and dep.referenced_owner not in ('SYS', 'SYSTEM', 'PUBLIC', 'XDB')
and dep.referenced_type = 'PACKAGE'
and dep.dependency_type != 'NON-EXISTENT'
and (dep.referenced_owner || '.' || dep.referenced_name) != (dep.owner || '.' || dep.name)
),
dep3 as (
select owner || '.' || name as child,
referenced_owner || '.' || referenced_name as parent
from dep2
)
select connect_by_root parent, lpad(' ',2*(level-1)) || to_char(child)
from dep3
start with parent = 'SCHEMA.PACKAGE_NAME'
connect by nocycle prior child = parent
and exists (select 1 from all_source where (owner || '.' || name) = dep3.child and upper(text) like upper('%optional, some string you may want to search%'))
;