诱宵美九唱的歌:insert into (select ... from ... where ... with check option) values ...
来源:百度文库 编辑:九乡新闻网 时间:2024/04/20 18:46:27
SQL> create table test(id varchar2(20) not null primary key,mc varchar2(60));
Table created
SQL> insert into (select id,mc from test where id='1') values('1','111111');
1 row inserted
SQL> select * from test;
ID MC
-------------------- ------------------------------------------------------------
1 111111
SQL> insert into (select id,mc from test where id='1') values('1','111111');
insert into (select id,mc from test where id='1') values('1','111111')
ORA-00001: 违反唯一约束条件 (ROME.SYS_C0027236)
SQL> insert into (select id,mc from test where id='1') values('2','222222');
1 row inserted
SQL> insert into (select id,mc from test where id='10') values('3','333333');
1 row inserted
SQL> select * from test;
ID MC
-------------------- ------------------------------------------------------------
1 111111
2 222222
3 333333
SQL> insert into (select id,mc from test where id='10' with check option) values('5','555555');
insert into (select id,mc from test where id='10' with check option) values('5','555555')
ORA-01402: 视图 WITH CHECK OPTIDN where 子句违规
SQL> insert into (select id,mc from test where 1=1 with check option) values('5','555555');
1 row inserted
SQL> select * from test;
ID MC
-------------------- ------------------------------------------------------------
1 111111
2 222222
3 333333
5 555555
zhouwf0726 发表于:2007.05.11 10:50 ::分类: ( oracle开发 ) ::阅读:(1824次) :: 评论 (0) :: 引用 (0)