所以我在oracle中并使用dba_dependencies来生成依赖表。我想使用CTE以递归方式查看依赖项。
with recurs (name, owner, type, rname, rowner, rtype, lvl ) as (
select name, owner, type, referenced_name, referenced_owner, referenced_type, 1
from dba_dependencies
where referenced_name =:object_name
union all
select a.name,a.owner, a.type, a.referenced_name,a.referenced_owner, a.referenced_type, r.lvl + 1
from dba_dependencies a inner join recurs r
on r.name = a.referenced_name
and r.owner = a.referenced_owner
and r.type = a.referenced_type
)
select *
from recurs;
但似乎有一个问题,它返回一个非常短的列表,不匹配依赖项的数量。谁知道问题可能是什么?谢谢!
答案 0 :(得分:0)
您可能需要使用CONNECT BY
SELECT *
FROM dba_dependencies
START WITH referenced_name =:object_name
CONNECT BY PRIOR name = referenced_name
and owner = referenced_owner
and type = referenced_type