[sql] 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%'

This question is related to sql oracle stored-procedures full-text-search toad

The answer is


 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.


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


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


Examples related to sql

Passing multiple values for same variable in stored procedure SQL permissions for roles Generic XSLT Search and Replace template Access And/Or exclusions Pyspark: Filter dataframe based on multiple conditions Subtracting 1 day from a timestamp date PYODBC--Data source name not found and no default driver specified select rows in sql with latest date for each ID repeated multiple times ALTER TABLE DROP COLUMN failed because one or more objects access this column Create Local SQL Server database

Examples related to oracle

concat yesterdays date with a specific time ORA-28001: The password has expired how to modify the size of a column How to create a blank/empty column with SELECT query in oracle? Find the number of employees in each department - SQL Oracle Query to display all tablespaces in a database and datafiles When or Why to use a "SET DEFINE OFF" in Oracle Database How to insert date values into table error: ORA-65096: invalid common user or role name in oracle In Oracle SQL: How do you insert the current date + time into a table?

Examples related to stored-procedures

How to create temp table using Create statement in SQL Server? How do I pass a list as a parameter in a stored procedure? SQL Server IF EXISTS THEN 1 ELSE 2 Stored procedure with default parameters Could not find server 'server name' in sys.servers. SQL Server 2014 How to kill all active and inactive oracle sessions for user EXEC sp_executesql with multiple parameters MySQL stored procedure return value SQL Server: use CASE with LIKE SQL server stored procedure return a table How to actually search all files in Visual Studio SQL Server 2012 Install or add Full-text search MySQL match() against() - order by relevance and column? Cannot use a CONTAINS or FREETEXT predicate on table or indexed view because it is not full-text indexed Searching for Text within Oracle Stored Procedures How to search contents of multiple pdf files? How to search multiple columns in MySQL? SQL to search objects, including stored procedures, in Oracle Comparison of full text search engine - Lucene, Sphinx, Postgresql, MySQL? Vim clear last search highlighting

Examples related to toad

Why does Oracle not find oci.dll? How can I solve ORA-00911: invalid character error? ORA-12170: TNS:Connect timeout occurred How can I get all sequences in an Oracle database? Is there a workaround for ORA-01795: maximum number of expressions in a list is 1000 error? Using IF ELSE in Oracle How to debug a stored procedure in Toad? SQL query for extracting year from a date Toad for Oracle..How to execute multiple statements? Searching for Text within Oracle Stored Procedures