oracle 搜索 PL/SQL 代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/630847/
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
Search PL/SQL Code
提问by Jeff
SELECT * from ALL_OBJECTS returns the names of various procedures/packages/tables/other db objects. I want to look inside the PL/SQL code for a matching string. How do I do this?
SELECT * from ALL_OBJECTS 返回各种过程/包/表/其他数据库对象的名称。我想查看匹配字符串的 PL/SQL 代码。我该怎么做呢?
Something like: (pseudocode) SELECT * FROM all_code WHERE line_of_code like '%mytext%'
类似于:(伪代码)SELECT * FROM all_code WHERE line_of_code like '%mytext%'
回答by Ascalonian
Use something like:
使用类似的东西:
SELECT *
FROM USER_SOURCE
WHERE type='PACKAGE'
AND NAME='PACKAGE_NAME'
ORDER BY type, name, line;
There are many options, check out the USER_SOURCE table.
有很多选项,查看 USER_SOURCE 表。
To search ALL code for a String:
要搜索字符串的所有代码:
SELECT *
FROM ALL_SOURCE
WHERE UPPER(text) LIKE UPPER('%what I am searching for%')
ORDER BY type, name, line
Note that view code is not included in the _SOURCE
tables. View code is stored in [USER|ALL|DBA]_VIEWS.TEXT
which is a LONG column and difficult to query.
请注意,_SOURCE
表格中不包含视图代码。视图代码存储在[USER|ALL|DBA]_VIEWS.TEXT
其中是一个 LONG 列,很难查询。