O 当你用如下语句建立视图时,即加了 with read only 参数, create or replace view as select * from table with read only 就会在 user_constraints 里面查到 constraint_type='O' 但严格地讲,这并不是ORACLE的约束,不信,你这样就查不到了 select a.table_name,a.constraint_type,b.column_name from user_constraints a,user_cons_columns where a.constraint_name=b.constraint_name;R 至于 R,这个就是 References/Foreign Key 啊!
补充一下,刚才我说的 with read only 要说是约束也没关系,不过一般书上 好想都不认为这是约束.不知大家有否高见?
仔细想想,觉得 with read only 是属于视图约束的,不过知道这个意思就行了。
谢谢楼上两位兄台. 补充一下: 1---C:不止是代表CHECK KEY,对字段设定了NOT NULL限定时也会产生C类型约束; 2---至于 select a.table_name,a.constraint_type,b.column_name from user_constraints a,user_cons_columns where a.constraint_name=b.constraint_name; 为什么得不到预想中的0类型约束,是不是因为user_cons_columns仅仅记录了table的约束情况,而没有记录VIEW中的约束情况?个人认为ATCG提及的"视图约束"非常好.
create or replace view as select * from table with read only
就会在 user_constraints 里面查到 constraint_type='O'
但严格地讲,这并不是ORACLE的约束,不信,你这样就查不到了
select a.table_name,a.constraint_type,b.column_name
from user_constraints a,user_cons_columns
where a.constraint_name=b.constraint_name;R 至于 R,这个就是 References/Foreign Key 啊!
好想都不认为这是约束.不知大家有否高见?
补充一下:
1---C:不止是代表CHECK KEY,对字段设定了NOT NULL限定时也会产生C类型约束;
2---至于
select a.table_name,a.constraint_type,b.column_name
from user_constraints a,user_cons_columns
where a.constraint_name=b.constraint_name;
为什么得不到预想中的0类型约束,是不是因为user_cons_columns仅仅记录了table的约束情况,而没有记录VIEW中的约束情况?个人认为ATCG提及的"视图约束"非常好.
而“视图约束”是我随便取的名字,不必太在意,知道这个意思就行了。