如何检查 Oracle 中的数据库对象是 table 还是视图
How to check if a database object in Oracle is a table or view
我有一个对象名称列表,我必须从中找出对象是 table 还是视图。为此,我必须查询并签入 all_tables 和 all_views 并确认对象是 table 还是视图。我正在使用以下查询及其工作。但是因为我有大量的对象名称列表,所以我想在单个查询中执行此操作并检查对象是 table 还是视图以及对象的所有者。
select * from ALL_views where view_name like '%INSTANCE%'
select * from all_tables where table_name like '%INSTANCE%'
select *
from all_objects
where object_name like '%INSTANCE%'
那里有一个 OBJECT_TYPE 列。
使用 all_objects 怎么样?
例如:
select owner,
object_name,
object_type
from all_objects
where object_type in ('TABLE', 'VIEW')
and object_name in (....);
我有一个对象名称列表,我必须从中找出对象是 table 还是视图。为此,我必须查询并签入 all_tables 和 all_views 并确认对象是 table 还是视图。我正在使用以下查询及其工作。但是因为我有大量的对象名称列表,所以我想在单个查询中执行此操作并检查对象是 table 还是视图以及对象的所有者。
select * from ALL_views where view_name like '%INSTANCE%'
select * from all_tables where table_name like '%INSTANCE%'
select *
from all_objects
where object_name like '%INSTANCE%'
那里有一个 OBJECT_TYPE 列。
使用 all_objects 怎么样?
例如:
select owner,
object_name,
object_type
from all_objects
where object_type in ('TABLE', 'VIEW')
and object_name in (....);