示例說明
在BOOKS表中
WITH CHECK OPTION
通過視圖添加
假設在前面的練習中
CREATE VIEW vwBookPricesFirst
AS SELECT
bk_id
FROM books
WHERE bk_id <=
盡管如此
除非讀者故意要實現這樣的功能
只需要將WITH CHECK OPTION添加到視圖的定義中
CREATE VIEW vwBookPricesFirst
AS SELECT
bk_id
FROM books
WHERE bk_id <=
WITH CHECK OPTION;
INSERT INTO vwBookPricesFirst
Msg
The attempted insert or update failed because the target view either
specifies WITH CHECK OPTION or spans a view that specifies WITH CHECK OPTION
and one or more rows resulting from the operation did not qualify under
the CHECK OPTION constraint
The statement has been terminated
請注意
在入口處檢查數據將帶來嚴重的性能損失
CHECK OPTION是SQL標准的一部分
返回目錄
編輯推薦
Oracle索引技術
高性能MySQL
數據倉庫與數據挖掘培訓視頻教程
From:http://tw.wingwit.com/Article/program/SQL/201311/16458.html