oracle 关于pl/sql存储程序文本的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1754590/
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
question about pl/sql stored program text
提问by Just a learner
I use TOAD to do my PL/SQL development. In TOAD when i type a procedure name and press f4, I can see this procedure's source code. I think TOAD get the source code from v$sqltext view. To confirm my thought, I wrote a query:
我使用 TOAD 进行 PL/SQL 开发。在 TOAD 中,当我输入程序名称并按 f4 时,我可以看到此程序的源代码。我认为 TOAD 从 v$sqltext 视图中获取源代码。为了证实我的想法,我写了一个查询:
select * from v$sqltext
but when I execute the upper query, Oracle give me an error:
但是当我执行上层查询时,Oracle给我一个错误:
ORA-00942: table or view does not exist 00942. 00000 - "table or view does not exist" *Cause:
*Action: Error at Line: 29 Column: 15
ORA-00942: 表或视图不存在 00942. 00000 - “表或视图不存在” *原因:
*操作:第 29 行错误:15
So I think TOAD get the procedure's source from other place instead of v$sqltext view. Anyone can tell me about this? Great thanks.
所以我认为 TOAD 从其他地方而不是 v$sqltext 视图获取程序的源代码。任何人都可以告诉我这件事吗?万分感谢。
回答by Tony Andrews
The full query for a stored procedure (not in a package):
存储过程的完整查询(不在包中):
select text
from all_source
where owner = 'MYSCHEMA'
and type = 'PROCEDURE'
and name = 'MY_PROCEDURE'
order by line;
If you are connected as user MYSCHEMA than you can use USER_SOURCE:
如果您以 MYSCHEMA 用户身份连接,则可以使用 USER_SOURCE:
select text
from user_source
where type = 'PROCEDURE'
and name = 'MY_PROCEDURE'
order by line;
Other values for TYPE are:
TYPE 的其他值是:
- TYPE BODY
- FUNCTION
- TRIGGER
- TYPE
- JAVA SOURCE
- PACKAGE BODY
- PACKAGE
- 体型
- 功能
- 扳机
- 类型
- 爪哇源
- 包装体
- 包裹
回答by Egor Rogov
select * from all_source
select * from all_source
See Database Reference for ALL_SOURCEand V$SQLTEXT.
请参阅ALL_SOURCE和V$SQLTEXT 的数据库参考。
回答by Guru
If you have select priv on DBA* tables, then do check out select * from dba_source
. This table will have the entire source code.
如果您在 DBA* 表上选择了 priv,那么请检查select * from dba_source
. 该表将包含完整的源代码。