![]() INSERT INTO departments_hq VALUES (300, 'NETWORKING', 1700) For example, the following INSERT statement successfully inserts a row into the departments table with the departments_hq view, which contains all rows with location 1700: Furthermore, the CHECK OPTION creates the view with the constraint (named departments_hq_cnst) so that INSERT and UPDATE statements issued against the view cannot result in rows that the view cannot select. The query that defines the departments_hq view references only rows in location 1700. WITH CHECK OPTION CONSTRAINT departments_hq_cnst SELECT department_id, department_name, location_id The following statement creates a view on a subset of data in the hr.departments table: As with all subqueries, the query that defines a view cannot contain the FOR UPDATE clause. Each view is defined by a query that references tables, materialized views, or other views. You can create views using the CREATE VIEW statement. If the owner of the view intends to grant access to the view to other users, the owner must have received the object privileges to the base objects with the GRANT OPTION or the system privileges with the ADMIN OPTION. For example, if the owner of the view has only the INSERT privilege for Scott's emp table, then the view can be used only to insert new rows into the emp table, not to SELECT, UPDATE, or DELETE rows. Also, the functionality of the view depends on the privileges of the view owner. The owner cannot have obtained these privileges through roles. The owner of the view (whether it is you or another user) must have been explicitly granted privileges to access all objects referenced in the view definition. You can acquire these privileges explicitly or through a role. To create a view in another user's schema, you must have the CREATE ANY VIEW system privilege. ![]() ![]() To create a view in your schema, you must have the CREATE VIEW privilege.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |