with read only和with check option

今天看视频with read only和with check option这两个东西听的很晕,事实上以前就很晕


看见网上的一位朋友的讲解还蛮清晰的,摘录一下


建视图有三种模式: 


1、默认的模式,就是什么也不加。
--可以更新的

create or replace view 视图名 as
    select xxx from 表名;
--不可以可以更新的
create or replace view 视图名 as
    select xxx from 表名1 a,表名2 b where a.xxx=b.xxx;
--还有很多种情况不允许更新呢,比如视图中用了distinct、group by 等


2、with read only 只读视图,不允许通过本视图更新本表

create or replace view 视图名 as
    select xxx from 表名 with read only;

3、with check option 允许通过视图更新本表,但是要check 视图的where条件。

create or replace view 视图名 as
    select xxx from 表名 where id < 10 with check option;



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章