RESTORE_VIEW procedure

Restores the specified view which was previously saved with SAVE_VIEW procedure.

Prototypes

RESTORE_VIEW(ASCHEMA VARCHAR(128), AVIEW VARCHAR(128))
RESTORE_VIEW(AVIEW VARCHAR(128))

Description

RESTORE_VIEW is a utility procedure which restores the specified view using the SQL found in SAVED_VIEWS, which is populated initially by a call to SAVE_VIEW procedure or SAVE_VIEWS procedure. It also implicitly calls RESTORE_AUTH procedure to ensure that authorizations are not lost. This is the primary difference between using SAVE_VIEW procedure and RESTORE_VIEW, and using DB2’s inoperative view mechanism with the RECREATE_VIEW procedure procedure.

Another use of these procedures is in recreating views which need to be dropped surrounding the update of a UDF.

Note

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

Parameters

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

Examples

Restore the definition of the FINANCE.LEDGER_CHANGES view:

CALL RESTORE_VIEW('FINANCE', 'LEDGER_CHANGES');

Restore the definition of the EMPLOYEE_CHANGES view in the current schema:

CALL RESTORE_VIEW('EMPLOYEE_CHANGES');