December 2001
Intermediate to advanced
800 pages
17h 55m
English
An updatable view can be created so that it checks updates for compliance with its WHERE clause, if it has one. This prevents rows added via the view from “vanishing” when the view is requeried because they don't meet its selection criteria. To set up a view this way, use the WITH CHECK OPTION clause when you create it (Listing 9-10):
CREATE VIEW CALIFORNIA_AUTHORS AS SELECT * FROM authors WHERE State='CA' WITH CHECK OPTION |
This particular example ensures that any author that's added via the view resides in California. For example, the statement in Listing 9-11 fails because of WITH CHECK OPTION:
Read now
Unlock full access