Views
A view does not contain data; it is a stored definition of a set of rows and columns. A view can present any or all of the data in one or more tables.
Although you cannot modify an existing view, you can drop it and create a new one if your base tables change in a way that affects the view. Dropping and creating views does not affect the base tables or their data.
Restrictions when changing data through a view
Some views are read-only and thus cannot be used to update the table data. For those views that are updatable, several restrictions apply.
- You must have the appropriate authorization to insert, update, or delete rows using the view.
- When you use a view to insert a row into a table, the view definition must specify all the columns in the base table that do not have a default value. The row that is being inserted must contain a value for each of those columns.
- Views that you can use to update data are subject to the same
referential constraints and check constraints as the tables that you
used to define the views.
You can use the WITH CHECK option of the CREATE VIEW statement to specify the constraint that every row that is inserted or updated through the view must conform to the definition of the view. You can select every row that is inserted or updated through a view that is created with the WITH CHECK option.
- For an update operation on a view that references an application-period temporal table or a bitemporal table, the result table of the outer fullselect of the view definition, explicitly or implicitly, must include the start and end columns of the BUSINESS_TIME period.
- For an update or delete operation on a view that references an application-period temporal table or a bitemporal table, the view must not be defined with an INSTEAD OF trigger.
For complex views, you can make insert, update and delete operations possible by defining INSTEAD OF triggers.