How to find text in Oracle PL/SQL source code
Before you rename a column or change a table, find every piece of code that uses it. Oracle keeps the source of stored PL/SQL in the data dictionary.
Search ALL_SOURCE
ALL_SOURCE holds the source of packages, package bodies, procedures, functions, triggers and types you can see, one row per line:
select owner, name, type, line, trim(text) as text
from all_source
where upper(text) like '%ORDER_STATUS%'
order by owner, name, type, line;Use USER_SOURCE for your own schema only, or DBA_SOURCE with the privilege to see every schema.
What it misses
- Views: their text is in ALL_VIEWS.TEXT, a LONG column that LIKE cannot search directly.
- A name split over two lines, or built in dynamic SQL ('ORDER_' || 'STATUS').
- Your saved .sql scripts, which are not in the database at all.
Dependencies
For a table, ALL_DEPENDENCIES lists the code that depends on it, without searching text:
select owner, name, type
from all_dependencies
where referenced_name = 'ORDERS' and referenced_type = 'TABLE';In Felix
Tools › Advanced Search (Ctrl+Shift+D) searches object names and the source code of database objects, the values in your tables (Data Value Search), and your saved .sql files, in one window.
More about it: Oracle SQL and PL/SQL editor in Felix.
Try it on your own database
Felix is a Windows IDE for Oracle SQL and PL/SQL, from 11g to 23ai. Every feature is in the free 30-day trial; no account needed.