如何知道所创建的视图是否有效 [英] How to know whether the created view is valid or not

查看:101
本文介绍了如何知道所创建的视图是否有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新数据库.

让我们说我创建了一个有力的视图.

Lets say I have created a view with force.

那么我怎么知道所创建的视图是否无效?

So how can I get know whether the view created is invalid or not?

我的意思是,有什么查询可以让我了解视图的有效性状态吗?

I mean are there any queries from which I can get to know the validity status of the view?

谢谢.

推荐答案

您可以使用Oracle词典视图user_objects:

You can use Oracle dictionary view user_objects:

select object_name, status from user_objects 
where object_type = 'VIEW' and object_name = 'YOUR_VIEW';

如果出于任何原因更改了视图所基于的表,则可能必须重新编译视图.例如,如果表的结构发生了改变(例如,通过更改列的数据类型),或者如果一列从表中完全删除,则使用 按视图显示-然后可能会将视图的状态更改为无效".

If the table on which the view is based is altered for any reason, you may have to recompile the view. For example, if a table’s structure is altered, such as by a change to a column’s datatype, or perhaps if a column is dropped from the table altogether - a column that is used by the view — then it may change the status of the view to 'INVALID'.

还要注意,存在所有对象"视图的版本:

Also note that there are there versions of "all objects" view:

USER_OBJECTS-当前用户拥有的所有对象;
ALL_OBJECTS-当前用户对其具有任何特权的所有对象;
DBA_OBJECTS-所有数据库对象(您将需要特殊权限才能访问此视图)

USER_OBJECTS - all objects owned by a current user;
ALL_OBJECTS - all objects on which a current user has any privileges;
DBA_OBJECTS - all database objects (you would need special privileges to access this view)

ALL_和DBA_版本具有附加的列OWNER,其中包含对象的所有者.

ALL_ and DBA_ versions have an additional column OWNER containing the owner of the object.

这些命名规则"适用于不同的Oracle词典视图:[USER_ | ALL_ | DBA_] [INDEXES |桌子|意见|等]

These "naming rules" are applied to the different Oracle dictionary views: [USER_ | ALL_ | DBA_] [INDEXES | TABLES | VIEWS | etc]

这篇关于如何知道所创建的视图是否有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆