updateable views - Oracle docs seems wrong
The docs say:
Note: Updateable views can not include:
- Set Operators (INTERSECT, MINUS, UNION, UNION ALL)
- DISTINCT
- Group Aggregate Functions (AVG, COUNT, MAX, MIN, SUM, etc.)
- GROUP BY Clause
- ORDER BY Clause
- CONNECT BY Clause
- START WITH Clause
- Collection Expression In A Select List
- Subquery In A Select List
- Join Query
I did the following:
dev05 > create table baseTable (name varchar(20));
Table created.
dev05 > insert into baseTable values('Scott');
1 row created.
dev05 > create view testView as (select distinct name from baseTable);
View created.
dev05 > insert into baseTable values ('Scott');
1 row created.
dev05 > insert into baseTable values ('Tiger');
1 row created.
dev05 > select * from baseTable;
NAME
--------------------
Scott
Scott
Tiger
dev05 > update testView set name='Scottie' where name='Scott';
update testView set name='Scottie' where name='Scott'
*
ERROR at line 1:
ORA-01732: data manipulation operation not legal on this view
As we can see, when a distinct is used to create the view, we cannot update, BUT, we can clearly insert!
Someone please clarify.
thanks