Tuesday, August 13, 2013

Oracle: Search text in name of tables and columns

Just a couple of handy Oracle SQL sentences to search for a specific string contained in the name of tables and columns. I found them useful when working in maintenance for legacy systems, or big projects where you didn't start from the beginning.

To search inside name of tables, indexes, etc:

SELECT * 
FROM dba_objects 
WHERE object_name LIKE '%STRING%';

To search inside name of columns:

SELECT owner, table_name, column_name 
FROM all_tab_columns 
WHERE column_name LIKE '%COL_STRING%';

No comments:

Post a Comment