RECREATE_VIEW procedure

Recreates the specified inoperative view from its definition in the system catalogue.

Prototypes

RECREATE_VIEW(ASCHEMA VARCHAR(128), AVIEW VARCHAR(128))
RECREATE_VIEW(AVIEW VARCHAR(128))

Description

RECREATE_VIEW is a utility procedure which recreates the specified view using the SQL found in the system catalog tables. It is useful for quickly recreating views which have been marked inoperative after a change to one or more of the view’s dependencies. If ASCHEMA is omitted it defaults to the current schema.

Note

This procedure is effectively redundant as of DB2 9.7 due to the new deferred revalidation functionality introduced in that version.

Warning

This procedure does not drop the view before recreating it. This guards against attempting to recreate an operative view (an inoperative view can be recreated without dropping it first). That said, it will not return an error in the case of attempting to recreate an operative view; the procedure will simply do nothing.

Warning

See SAVE_AUTH procedure for warnings regarding the loss of authorization information with inoperative views.

Parameters

ASCHEMA
If provided, specifies the schema containing the view to recreate. If omitted, defaults to the value of the CURRENT SCHEMA special register.
AVIEW
The name of the view to recreate.

Examples

Recreate the inoperative FOO.BAR view:

CALL RECREATE_VIEW('FOO', 'BAR');

Recreate the BAZ view in the current schema:

CALL RECREATE_VIEW('BAZ');