ALTER VIEW statement

Description

Replaces a view definition with a modified version. You must include the entire new view definition in the ALTER VIEW statement.

Syntax

ALTER VIEW
... [ owner.]view-name [( column-name [, ...] )]
... AS select-without-order-by
... [ WITH CHECK OPTION ]

Usage

The ALTER VIEW statement is identical in syntax to the CREATE VIEW statement. ALTER VIEW replaces the entire contents of CREATE VIEW with the contents of ALTER VIEW. Existing permissions on the view are maintained, and need not be reassigned. If a DROP VIEW followed by CREATE VIEW is used, instead of ALTER VIEW, permissions on the view must be reassigned.

NoteIf SELECT * is used in a view definition and a table referenced by the SELECT * is altered, then you must run ALTER VIEW <viewname> RECOMPILE to ensure that the view definition is correct and to prevent unexpected results when the view is queried.


Side Effects

Automatic commit.

Standards

Permissions

Must be owner of the view or have DBA authority.

See also

CREATE VIEW statement

DROP statement