Skip to content
Advertisement

I am dropping the with check option constraint from view but it is not being enforced

So I am stuck in a problem. I defined a view with the WITH CHECK OPTION constraint, now i wish to delete it, but even after dropping the constraint i get the error :=ora-01402: view WITH CHECK OPTION where- clause violation. this is the sequence of SQL commands i am executing –

$>>CREATE VIEW CHEAP_PRODUCTS AS SELECT * FROM PRODUCTS WHERE PRICE<15 WITH CHECK OPTION CONSTRAINT CHECK_OP;
modified
$>>ALTER VIEW CHEAP_PRODUCTS DROP CONSTRAINT CHECK_OP;
view altered
$>> INSERT INTO CHEAP_PRODUCTS(PRODUCT_ID,PRODUCT_TYPE_ID,NAME,PRICE) VALUES (50,1,'EASTERN FRONT',88);
ora-01402: view WITH CHECK OPTION where- clause violation.

I cant figure why this is the case as i have dropped the constraint.

Advertisement

Answer

The existence of the constraint is more annotative, that is, a mechanism to let you know about the restrictions on the view. You’ll see a constraint type “V” for CHECK OPTION and “O” for READ ONLY.

But it is the view definition that still decides what is allowed on the view. Dropping the constraint won’t change that – but it will lose the (easy) mechanism to see what constraints are on the view. Without it, now you have to dig around in the text of the view definition to work it out.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement