47

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%'

4 Answers 4

94
 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
  • 1
    You rock! Thanks much Shannon!
    – PseudoToad
    Feb 17, 2011 at 19:57
  • 2
    If you want to limit the search to a specific schema, you can add AND OWNER = 'SCHEMA OWNER NAME'. Feb 17, 2011 at 20:54
3

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

1
  • 3
    To critique another answer, please use a comment. (Requires 50 reputation which you can earn by posting useful answers and questions.)
    – Baum mit Augen
    Feb 2, 2017 at 10:47
2

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

0

For me, the given query didn't work. It was showing no result. I really don't know why. But "Dependancy" feature of SQLDeveloper saved my day!!!.

In SQLDeveloper, when you select the table in lefthand side "connection" view, tables details opened in the "document" view on righthand side. There are many tabs in document view like columns, data, model, constrain etc. One of the tab is "Dependancy". This tabs list all the objects like triggers, indexes, functions, procedures etc where table is refered.

For TOAD, I think, it is "Referantial" and "Used By" tabs. (Not sure about it, please refer TOAD referrance materials)

Hope this will help someone who is struggling with query like me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.