具有两个特定列的表列表

List of tables having two specific columns

有没有办法获取 oracle 数据库中的表列表,其中有两个特定的列(一起,不是任何一个)。

select table_name from all_tab_columns where column_name in ('CLOUMNNAME1','CLOUMNNAME2');

它给了我所有有一个或两个的表。但我需要那些同时拥有两列的人。

只需找到 return 2 行的表格:

SELECT table_owner, TABLE_NAME FROM ALL_TAB_COLUMNS where column_name in ('CLOUMNNAME1','CLOUMNNAME2') 
GROUP BY table_owner, TABLE_NAME HAVING COUNT(*) = 2;

编辑:添加 "table_owner" 以避免来自不同模式的表共享 table_name