Posted  by  admin

Update With Check Option Oracle

Update With Check Option Oracle 4,8/5 1085 votes
Update With Check Option Oracle

A view is a named and validated SQL query which is stored in the Oracle. 2 WITH CHECK OPTION; View created. SQL> UPDATE d20. View WITH CHECK OPTION.

With Check Option Oracle

Without WITH CHECK OPTION, updating ( INSERT/ UPDATE/ MERGE/ DELETE etc) a viewed table will cause its underlying base tables to be updated, regardless of the WHERE clause of the VIEW (assuming the DBMS considers the view to be updateable). If you INSERT a row into a VIEW that didn't satisfy the WHERE clause then refreshed the VIEW the newly-inserted row would not be visible in the VIEW. The WITH CHECK OPTION would prevent such an 'odd' situation from happening but there is more to it than that. Consider a VIEW that is created to allow a certain user (group of users, application, etc) to view only a subset of rows in a table e.g. To allow them to view data for staff while preventing them from viewing the details of executive employees: revoke read privileges on the base table for this user and instead grant them on the view.

Update With Check Option Oracle

With Check Option Sql

Update With Check Option Oracle

View With Check Option

The WITH CHECK OPTION allows you to do the same for write privileges, in this case it would prevent an INSERT to tehe view if it would create a executive employee row. Similar techniques can be used to enforce 'row-level' constraints e.g. That a company can only have one president by forcing the INSERT via a VIEW whose WHERE clause only allows for one employee per company.