DROP MATERIALIZED VIEW
VIEW statement to remove an existing materialized view from the database.
SNAPSHOT is supported in place of
VIEW for backward compatibility.
The materialized view must be in your own schema or you must have the
VIEW system privilege. You must also have the privileges to drop the internal table, views, and index that Oracle uses to maintain the materialized view's data.
DROP TABLE, DROP VIEW, and DROP INDEX for information on privileges required to drop objects that Oracle uses to maintain the materialized view
Text description of drop_materialized_view
Specify the schema containing the materialized view. If you omit schema, Oracle assumes the materialized view is in your own schema.
Specify the name of the existing materialized view to be dropped.
- If you drop a simple materialized view that is the least recently refreshed materialized view of a master table, Oracle automatically purges from the master table's materialized view log only the rows needed to refresh the dropped materialized view.
- If you drop a master table, Oracle does not automatically drop materialized views based on the table. However, Oracle returns an error when it tries to refresh a materialized view based on a master table that has been dropped.
- If you drop a materialized view, any compiled requests that were rewritten to use the materialized view will be invalidated and recompiled automatically. If the materialized view was prebuilt on a table, the table is not dropped, but it can no longer be maintained by the materialized view refresh mechanism.
Dropping a Materialized View: Examples
The following statement drops the materialized view
emp_data in the sample schema
DROP MATERIALIZED VIEW emp_data;
The following statement drops the
sales_by_month_by_state materialized view and the underlying table of the materialized view (unless the underlying table was registered in the
VIEW statement with the
DROP MATERIALIZED VIEW sales_by_month_by_state;