如何在 Oracle 中查看 PL/SQL 存储函数体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14212295/
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
How to see PL/SQL Stored Function body in Oracle
提问by Vallabh Patade
I have a stored function in Oracle database pAdCampaign.fGetAlgoGroupKey. How to see the code of this function.?
我在 Oracle 数据库 pAdCampaign.fGetAlgoGroupKey 中有一个存储函数。怎么看这个函数的代码?
回答by DazzaL
If is a package then you can get the source for that with:
如果是一个包,那么您可以通过以下方式获取源代码:
select text from all_source where name = 'PADCAMPAIGN'
and type = 'PACKAGE BODY'
order by line;
Oracle doesn't store the source for a sub-program separately, so you need to look through the package source for it.
Oracle 不会单独存储子程序的源代码,因此您需要查看它的包源代码。
Note: I've assumed you didn't use double-quotes when creating that package, but if you did , then use
注意:我假设您在创建该包时没有使用双引号,但是如果您使用了,请使用
select text from all_source where name = 'pAdCampaign'
and type = 'PACKAGE BODY'
order by line;
回答by a_horse_with_no_name
SELECT text
FROM all_source
where name = 'FGETALGOGROUPKEY'
order by line
alternatively:
或者:
select dbms_metadata.get_ddl('FUNCTION', 'FGETALGOGROUPKEY')
from dual;
回答by Frank Schmitt
You can also use DBMS_METADATA:
您还可以使用 DBMS_METADATA:
select dbms_metadata.get_ddl('FUNCTION', 'FGETALGOGROUPKEY', 'PADCAMPAIGN')
from dual
回答by J. Chomel
You can use a proper tool like PLSQL-Developer.
您可以使用适当的工具,例如PLSQL-Developer。
If your environment is properly setup, it is as simple as hitting SHIFT+ F5when your text cursor is above the function / package name.
如果您的环境设置正确,当您的文本光标位于函数/包名称上方时,它就像点击SHIFT+一样简单F5。