Consultor Eletrônico



Kbase 18176: Can Not Update Views if More than One Table Defined in View
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/12/1998
Can Not Update Views if More than One Table Defined in View

DRAFT COPY - Currently under review and edit.

INTRODUCTION:
=============
If you are using views within your application and are trying to
update them then you should be aware of some limiting factors when
dealing with views.

WHY YOU NEED TO KNOW THIS:
===========================
You will not be able to UPDATE or INSERT INTO any view that is
defined as a select from more than one table.

PROCEDURAL APPROACH:
====================
If you define a view that contains only one table then you may update
that table through the view.

If you define a view that is references more than one table as part
of the select from statement then you will not be allowed to update
the view.

Example of an Updateable View:
Create View My_View
AS SELECT * FROM Customer
Where Name = 'Fred'.

This statement would create a view that could be updated because
it is selecting information from only one table.

Example of a View that CAN NOT BE UPDATED:
Create View This_View_Will_Not_Work
AS SELECT * FROM Customer,State
Where customer.name begins "Lift"
And State Matches "MA".

If you tried to do an Insert into This_View_Will_Not_Work then you
will get the error:
** View This_View_Will_Not_Work is not updatable. (975)
** Could not understand line 1. (196)

REFERENCES TO WRITTEN DOCUMENTATION:
====================================
SQL Guide and Reference sections 4.3.1 and 4.3.3