Home » SQL & PL/SQL » SQL & PL/SQL » What's WITH CHECK OPTION Mean
What's WITH CHECK OPTION Mean [message #2417] Sat, 13 July 2002 23:52 Go to next message
Alaa
Messages: 2
Registered: July 2002
Junior Member
I need your help to understand what does WITH CHECK OPTION used for specially in INSERT statment??
Re: What's WITH CHECK OPTION Mean [message #2418 is a reply to message #2417] Sun, 14 July 2002 10:09 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
If you use a subquery in place of a table, the WITH CHECK OPTION will enforce that the values supplied on the INSERT statement do not violate the subquery.

Straight from the documentation (available many places online):

The following statement is legal even though the second value violates the condition of the subquery where_clause:

INSERT INTO 
   (SELECT ename, deptno FROM emp WHERE deptno < 10)
    VALUES ('Taylor', 20);


However, the following statement is illegal because of the WITH CHECK OPTION clause:

INSERT INTO 
   (SELECT ename, deptno FROM emp
       WHERE deptno < 10
       WITH CHECK OPTION)
    VALUES ('Taylor', 20);
Previous Topic: External Proc Execution
Next Topic: HOW TO COUNT TABLES IN A SCHEMA
Goto Forum:
  


Current Time: Wed Apr 24 10:15:43 CDT 2024