question about pl/sql stored program text

為{幸葍}努か 提交于 2019-12-11 02:10:48

问题


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:

select * from v$sqltext

but when I execute the upper query, Oracle give me an error:

ORA-00942: table or view does not exist 00942. 00000 - "table or view does not exist" *Cause:
*Action: Error at Line: 29 Column: 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.


回答1:


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:

select text
from   user_source
where  type = 'PROCEDURE'
and    name = 'MY_PROCEDURE'
order by line;

Other values for TYPE are:

  • TYPE BODY
  • FUNCTION
  • TRIGGER
  • TYPE
  • JAVA SOURCE
  • PACKAGE BODY
  • PACKAGE



回答2:


select * from all_source

See Database Reference for ALL_SOURCE and V$SQLTEXT.




回答3:


If you have select priv on DBA* tables, then do check out select * from dba_source. This table will have the entire source code.



来源:https://stackoverflow.com/questions/1754590/question-about-pl-sql-stored-program-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!