Oracle Database - View


View in Oracle.


Which columns are updatable through a view

CREATE VIEW locations_view AS
   SELECT d.department_id, d.department_name, l.location_id,
   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

Documentation / Reference

Powered by ComboStrap