Oracle9i SQL Reference Release 2 (9.2) Part Number A96540-02 |
|
|
View PDF |
Use the ALTER
VIEW
statement to explicitly recompile a view that is invalid. Explicit recompilation lets you locate recompilation errors before run time. You may want to recompile a view explicitly after altering one of its base tables to ensure that the alteration does not affect the view or other objects that depend on it.
You can also use ALTER
VIEW
to define, modify, or drop view constraints.
When you issue an ALTER
VIEW
statement, Oracle recompiles the view regardless of whether it is valid or invalid. Oracle also invalidates any local objects that depend on the view.
See Also:
|
The view must be in your own schema or you must have ALTER
ANY
TABLE
system privilege.
alter_view::=
out_of_line_constraint::=
--part of constraints
syntax)Specify the schema containing the view. If you omit schema
, then Oracle assumes the view is in your own schema.
Specify the name of the view to be recompiled.
Use the ADD
clause to add a constraint to view
.
See Also:
|
Use the MODIFY
CONSTRAINT
clause to change the RELY
or NORELY
setting of an existing view constraint.
You cannot change the setting of a unique or primary key constraint if it is part of a referential integrity constraint without dropping the foreign key or changing its setting to match that of view
.
See Also:
|
Use the DROP
clause to drop an existing view constraint.
You cannot drop a unique or primary key constraint if it is part of a referential integrity constraint on a view.
The COMPILE
keyword is required. It directs Oracle to recompile the view.
To recompile the view customer_ro
(created in "Creating a Read-Only View: Example"), issue the following statement:
ALTER VIEW customer_ro COMPILE;
If Oracle encounters no compilation errors while recompiling customer_ro
, then customer_ro
becomes valid. If recompiling results in compilation errors, then Oracle returns an error and customer_ro
remains invalid.
Oracle also invalidates all dependent objects. These objects include any procedures, functions, package bodies, and views that reference customer_ro
. If you subsequently reference one of these objects without first explicitly recompiling it, then Oracle recompiles it implicitly at run time.