问题描述
我需要找到函数/过程(在包体内部定义)和它们使用的表之间的依赖关系.
I need to find dependencies between functions/procedures(defined inside package bodies) and tables which they use.
我已经尝试过 all_dependencies
但它仅适用于包级别,而不适用于内部函数/过程级别.是否有可能使用例如找到此依赖项all_source
?
I've tried all_dependencies
but it works only on the package-level, not the inner function/procedure-level. Is there any possibilty to find this dependencies using e.g. all_source
?
预先感谢您的帮助.
推荐答案
无法找到过程(在包中)和表之间的依赖关系.
It is not possible to find the dependencies between procedures (in a package) and tables.
有多种工具可以检查依赖关系.正如您已经发现的那样,*_DEPENDENCIES
仅跟踪每个包级别的对象依赖关系.有一个简洁的工具 PL/Scope跟踪包各部分之间的依赖关系.但它确实不会跟踪所有表引用.
There are several tools to examine dependencies. As you've already discovered, *_DEPENDENCIES
only tracks object dependencies on a per-package level. There is a neat tool PL/Scope that tracks dependencies between parts of a package. But it does it does not track all table references.
理论上你可以使用*_SOURCE
.实际上,这是不可能的,除非您的代码使用一组有限的功能.对于任何中等复杂的代码,不要使用字符串函数或正则表达式来解析代码.不幸的是,似乎没有任何可编程且能够准确解析复杂代码的 PL/SQL 解析器.
Theoretically you could use *_SOURCE
. In practice, this is impossible unless your code uses a limited set of features. For any moderately complicated code, forget about using string functions or regular expressions to parse code. Unfortunately there does not seem to be any PL/SQL parser that is both programmable and capable of accurately parsing complex code.
说这不可能"并不是一个好的答案.但在这种情况下,它可能会为您节省大量时间.这是很容易陷入死胡同并浪费大量精力的任务之一.
Saying "it's not possible" isn't a great answer. But in this case it might save you a lot of time. This is one of those tasks where it's very easy to hit a dead end and waste a lot of effort.
这篇关于PL/SQL 中的 Oracle 数据库依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!