Created
July 8, 2021 19:50
-
-
Save KrashLeviathan/13bcd53f4adcaea764a6e04e045e18f5 to your computer and use it in GitHub Desktop.
Oracle SQL query to search all source code for the given :search_text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH p AS ( SELECT lower('%' || :search_text || '%') as pattern FROM dual ) | |
SELECT | |
name, type, line, text | |
FROM | |
( SELECT name AS name, type AS type, line AS line, text AS text | |
FROM user_source join p on lower(text) like p.pattern | |
UNION ALL | |
SELECT view_name, 'VIEW', 0, text_vc | |
FROM user_views join p on lower(text_vc) like p.pattern | |
UNION ALL | |
SELECT table_name, 'TABLE', 0, table_name || '.' || column_name | |
FROM all_tab_columns join p on lower(table_name || '.' || column_name) like p.pattern | |
) | |
ORDER BY name, type, line; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment