Note
For V4.4.x, this statement is available starting with V4.4.2 BP1.
For V5.0.x, this statement is available starting with V5.0.1.
Purpose
This statement is used to explicitly recompile an invalid view or modify view constraints.
Privilege requirements
To execute this statement, you must have the ALTER ANY TABLE system privilege. For more information about OceanBase Database privileges, see Privilege types in Oracle-compatible mode.
Syntax
ALTER VIEW [schema_name.]view_name { COMPILE | RECOMPILE };
Parameters
Parameter |
Description |
|---|---|
| schema_name | Optional. The name of the schema to which the view belongs. |
| view_name | The name of the view that requires recompilation. |
| COMPILE | A keyword that instructs the database to perform a recompilation operation. |
| RECOMPILE | andCOMPILEThe same as RECOMPILE, instructs the database to perform a recompilation operation. The two can be used interchangeably. |
Examples
Use COMPILE to compile the view named customer_ro.
obclient> ALTER VIEW customer_ro COMPILE;
Use RECOMPILE to recompile the view named customer_ro.
obclient> ALTER VIEW customer_ro RECOMPILE;
