DB2 Version 9.7 for Linux, UNIX, and Windows

Modifying typed views

Certain properties of a typed view can be changed without requiring the view to be dropped and recreated. One such property is the adding of a scope to a reference column of a typed view.

About this task

The ALTER VIEW statement modifies an existing typed view definition by altering a reference type column to add a scope. The DROP statement deletes a typed view. You can also:
  • Modify the contents of a typed view through INSTEAD OF triggers
  • Alter a typed view to enable statistics collection

Changes you make to the underlying content of a typed view require that you use triggers. Other changes to a typed view require that you drop and then re-create the typed view.

The data type of the column-name in the ALTER VIEW statement must be REF (type of the typed table name or typed view name).

Other database objects such as tables and indexes are not affected although packages and cached dynamic statements are marked invalid.

Example

To alter a typed view using the command line, enter:
   ALTER VIEW <view_name> ALTER <column_name> 
      ADD SCOPE <typed table or view name>