如何查询Oracle数据库以显示Oracle数据库中所有表的名称?


当前回答

更进一步,还有一个名为cols (all_tab_columns)的视图,可用于确定哪些表包含给定的列名。

例如:

SELECT table_name, column_name
FROM cols
WHERE table_name LIKE 'EST%'
AND column_name LIKE '%CALLREF%';

查找名称以EST开头的所有表以及名称中任何位置包含CALLREF的列。

例如,根据表和列的命名约定,这可以帮助确定要连接哪些列。

其他回答

要获得所有的表名,我们可以使用:

Select  owner, table_name  from all_tables;

如果你有dba权限,你可以使用:

Select owner, table_name from dba_tables;

查询user_tables和dba_tables无效。 这一个做到了:

select table_name from all_tables  

包括视图:

SELECT owner, table_name as table_view
  FROM dba_tables
UNION ALL
SELECT owner, view_name as table_view
  FROM DBA_VIEWS

为当前用户选择表的简单查询:

  SELECT table_name FROM user_tables;

下面是一个注释的SQL查询片段,描述了如何使用选项:

-- need to have select catalog role
SELECT * FROM dba_tables;

-- to see tables of your schema
SELECT * FROM user_tables;

-- tables inside your schema and tables of other schema which you possess select grants on
SELECT * FROM all_tables;