如何在 Oracle 过程、函数和触发器中搜索字符串?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5019136/
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 search strings inside Oracle Procedures, Functions and Triggers?
提问by André
I need to find strings inside Oracle Procedures, Functions and Triggers.
我需要在 Oracle 过程、函数和触发器中查找字符串。
For SQLServer I use something like this:
对于 SQLServer 我使用这样的东西:
SELECT DISTINCT so.name
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE sc.TEXT LIKE '%m4_plf_par_periodo%'
There is something like this for Oracle?
Oracle 有这样的东西吗?
Give me a clue.
给我点暗示。
Best Regards,
此致,
回答by Vincent Malgrat
you can query ALL_SOURCE(contains the source to all programs you have access to).
您可以查询ALL_SOURCE(包含您有权访问的所有程序的源代码)。
Alternatively, DBA_SOURCEdescribes the text source of all stored objects in the database and USER_SOURCEcontains the text source of your stored objects only.
或者,DBA_SOURCE描述数据库中所有存储对象的文本源,而USER_SOURCE 仅包含存储对象的文本源。
回答by Tony Andrews
See this questionfor the solution using USER_SOURCE.
有关使用 USER_SOURCE 的解决方案,请参阅此问题。
回答by Jason
Use the "Find Database Object" wizard in free Oracle DB tool "SQL Developer".
使用免费的 Oracle DB 工具“SQL Developer”中的“查找数据库对象”向导。
To be exact, download and install Oracle SQL Developer from Oracle --> Create a new connection to the database, using a power-user --> In the SQL Developer menu choose "View" --> open menu item "Find DB Object" --> opens a Find Database Object Widget on the left panel--> Choose the DB connection --> Select specific schemas to search --> Select "All Source Lines" node --> type a string to search --> Click Go.
确切地说,从 Oracle 下载并安装 Oracle SQL Developer --> 使用高级用户创建到数据库的新连接 --> 在 SQL Developer 菜单中选择“查看” --> 打开菜单项“查找数据库对象” " -->在左侧面板上打开一个 Find Database Object Widget--> 选择数据库连接 --> 选择要搜索的特定模式 --> 选择“所有源行”节点 --> 键入要搜索的字符串 -->单击“前往”。
Expect it to do a non-cases-sensitive wild-card search in all source of Triggers/Procedures/Functions/Packages, owned by the selected schema and display a comprehensive search report of sample lines of code from each object where it was located.
期望它在所选模式拥有的所有触发器/过程/函数/包源中进行不区分大小写的通配符搜索,并显示来自它所在的每个对象的示例代码行的综合搜索报告。