oracle在insert时引入条件限制:with check option
实验:
1、创建表:
create table t (x number, y number);
2、插入数据:
insert into t values (1,null);
insert into t values (2,3000);
3、带有正确条件限制的插入:
insert into (select * from t where y in (3000,4000) with check option) values(3,3000);
4、带有错误条件的插入:
insert into (select * from t where y in (3000,4000) with check option) values(5,5000);
--会报错:
ERROR at line 1:
ORA-01402: view WITH CHECK OPTION where-clause violation