Oracle Database - View

> Database > Oracle Database

1 - About

View in Oracle.

Advertising

3 - Updatable

Which columns are updatable through a view

CREATE VIEW locations_view AS
   SELECT d.department_id, d.department_name, l.location_id, l.city
   FROM departments d, locations l
   WHERE d.location_id = l.location_id;
SELECT column_name, updatable 
   FROM user_updatable_columns
   WHERE TABLE_NAME = 'LOCATIONS_VIEW';

The primary key index on the location_id column of the locations table is not unique in the locations_view view. Therefore, locations is not a key-preserved table and columns from that base table are not updatable.

COLUMN_NAME                    UPD
------------------------------ ---
DEPARTMENT_ID                  YES
DEPARTMENT_NAME                YES
LOCATION_ID                    NO
CITY                           NO

4 - Documentation / Reference