Search notes:

Oracle: Find tables with given set of column names

The following queries finds all tables that have the column names listed in the column_name in (…) condition.
If the number of column names is changed in the condition, the value of the having clause needs to be changed as well.
select
   owner,
   table_name
from
   dba_tab_cols
where
   column_name in ('ID', 'TXT', 'DT', 'FLT', 'DBL')
group by
   owner,
   table_name
having
   count(*) = 5   -- <== Change number 
order by
   owner,
   table_name
;
Sometimes, we can only guess the name of the columns and need to search with like (or even regexp_like) as demonstrated in the following query. In order to improve the query's performance, I have also added where … owner = user. This condition needs to lifted or modified depending on table names and/or schema names that are looked for.
select
   owner,
   table_name
from
   dba_tab_cols
where
(  
   column_name like 'I%'    or
   column_name like '_X_'   or
   column_name like '%T'    or
   column_name like 'F_T'   or
   column_name like 'DB%'
)
and
   owner = user
group by
   owner,
   table_name
having
   count(*) = 5
order by
   owner,
   table_name
;

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199462, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/objects/tables/columns/find-table-with-given-column-names(77): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78