This restriction applies to insert statements when some NOT NULL columns are contained in the tables or views from which the view is derived.
For example, suppose null values are not allowed in a column of a table that underlies a view. Normally, when you insert new rows through a view, any columns in underlying tables that are not included in the view are given null values. If null values are not allowed in one or more of these columns, no inserts can be allowed through the view.
For example, in this view:
create view business_titles as select title_id, price, total_sales from titles where type = "business"
Null values are not allowed in the title column of the underlying table titles, so no insert statements can be allowed through business_view. Although the title column does not even exist in the view, its prohibition of null values makes any inserts into the view illegal.
Similarly, if the title_id column has a unique index, updates or inserts that would duplicate any values in the underlying table are rejected, even if the entry does not duplicate any value in the view.
Copyright © 2005. Sybase Inc. All rights reserved. |