INSERT using WITH CHECK OPTION

来源:互联网 发布:淘宝店延长收货是几天 编辑:程序博客网 时间:2024/04/28 18:54

--The following statement is legal even though
-- the third value inserted violates the condition
-- of the subquery where_clause:
 
INSERT INTO (SELECT department_id, department_name, location_id
   FROM departments WHERE location_id < 2000)
   VALUES (9999, 'Entertainment', 2500);
 
 
-- However, the following statement is illegal because it contains
-- the WITH CHECK OPTION clause:
 
INSERT INTO (SELECT department_id, department_name, location_id
   FROM departments WHERE location_id < 2000 WITH CHECK OPTION)
   VALUES (9999, 'Entertainment', 2500);
     *
ERROR at line 2:
ORA-01402: VIEW WITH CHECK OPTION where-clause violation

 

可以把那个子查询看成一个视图或者表,insert into table_name(or subquery) values();

原创粉丝点击