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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:45:39  来源:igfitidea点击:

Search PL/SQL Code

oraclesearchplsql

提问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 _SOURCEtables. View code is stored in [USER|ALL|DBA]_VIEWS.TEXTwhich is a LONG column and difficult to query.

请注意,_SOURCE表格中不包含视图代码。视图代码存储在[USER|ALL|DBA]_VIEWS.TEXT其中是一个 LONG 列,很难查询。