Oracle 视图

it2022-05-09  31

Oracle 视图

创建视图的语句CREATE VIEW 视图名字(字段) AS 子查询

如果视图更新了,连带原来表的记录也会更新,所以视图一般不更新,创建视图时可以添加两个规则。

1。with check option [constraint 名称]

create or replace view myview as

select * from emp

WITH CHECK OPTION CONSTRAINT empv20_ck;

保护视图的创建规则。

 

2。with read only

create or replace view myview as

select * from emp

with read only

这样视图就变成了只读的。不可以修改。如:update myview set sal=1530 where empno=116 就会失败

另:如果视图的基表有多行查询(比如:group by,distinct)那么该视图也是只读的

 

 

posted on 2010-11-07 09:43 Johnny_Z 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/Johnny_Z/archive/2010/11/07/1870948.html


最新回复(0)