Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching for Text within Oracle Stored Procedures

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%' 
like image 306
PseudoToad Avatar asked Feb 17 '11 19:02

PseudoToad


People also ask

How do I search for a word in Oracle SQL?

To enter an Oracle Text query, use the SQL SELECT statement. Depending on the type of index, you use either the CONTAINS or CATSEARCH operator in the WHERE clause. You can use these operators programatically wherever you can use the SELECT statement, such as in PL/SQL cursors.

How do I search for a string in PL SQL?

The PLSQL INSTR function is used for returning the location of a substring in a string. The PLSQL INSTR function searches a string for a substring specified by the user using characters and returns the position in the string that is the first character of a specified occurrence of the substring.


1 Answers

 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.

like image 108
Shannon Severance Avatar answered Oct 05 '22 17:10

Shannon Severance