oracle PL/SQL:检索包内过程和函数的名称
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1058881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PL/SQL: Retrieve names of procedures and functions within a package
提问by Adam Paynter
Is it possible to retrieve the names of all procedures and functions that reside within a particular package? I understand that they can be gleaned (smells hack-ish) from the ALL_SOURCE
view, but I would prefer a more canonical strategy.
是否可以检索驻留在特定包中的所有过程和函数的名称?我知道可以从视图中收集它们(闻起来像黑客一样)ALL_SOURCE
,但我更喜欢更规范的策略。
回答by Justin Cave
DBA_PROCEDURES has the public methods within a package
DBA_PROCEDURES 在包中具有公共方法
SELECT owner,
object_name AS package_name,
procedure_name AS method_name
FROM dba_procedures
WHERE object_type = 'PACKAGE'
If you also want private methods, that information is not directly accessible in the data dictionary. In that case, you'd need to parse the source (which would obviously be rather painful, particularly if you happen to have nested private methods within public or private methods in the package).
如果您还需要私有方法,则无法在数据字典中直接访问该信息。在这种情况下,您需要解析源代码(这显然会很痛苦,特别是如果您碰巧在包的公共或私有方法中嵌套了私有方法)。
回答by akf
the following will return all procedure and function names from a specific package:
以下将返回特定包中的所有过程和函数名称:
SELECT procedure_name FROM user_procedures WHERE object_name='mypackagename';