Searching for Text within Oracle Stored Procedures

大城市里の小女人 提交于 2019-12-03 05:38:12

问题


I need to search through all of the stored procedures in an Oracle database using TOAD. I am looking for anywhere that the developers used MAX + 1 instead of the NEXTVAL on the sequence to get the next ID number.

I've been doing SQL Server for years and know several ways to do it there but none are helping me here.

I've tried using

SELECT * FROM user_source
WHERE UPPER(text) LIKE '%blah%'

Results are returned but only for my default schema and not for the schema I need to be searching in.

I also tried the below but it just errors

SELECT * FROM SchemaName.user_source
WHERE UPPER(text) LIKE '%blah%'

回答1:


 SELECT * FROM ALL_source WHERE UPPER(text) LIKE '%BLAH%'

EDIT Adding additional info:

 SELECT * FROM DBA_source WHERE UPPER(text) LIKE '%BLAH%'

The difference is dba_source will have the text of all stored objects. All_source will have the text of all stored objects accessible by the user performing the query. Oracle Database Reference 11g Release 2 (11.2)

Another difference is that you may not have access to dba_source.




回答2:


I allways use UPPER(text) like UPPER('%blah%')




回答3:


If you use UPPER(text), the like '%lah%' will always return zero results. Use '%LAH%'.



来源:https://stackoverflow.com/questions/5033803/searching-for-text-within-oracle-stored-procedures

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