DROP INDEX statement

Use this statement to remove an index from the database.

Syntax
DROP INDEX { [ [owner.]table-name.]index-name | [ [owner.]materialized-view-name.]index-name }
Remarks

Use the IF EXISTS clause if you do not want an error returned when the DROP INDEX statement attempts to remove a database object that does not exist.

DROP INDEX is prevented when the statement affects an object that is currently being used by another connection.

Permissions

A user with REFERENCES permissions on the table can execute DROP INDEX.

The DROP INDEX statement cannot be executed when there are cursors opened with the WITH HOLD clause that use either statement or transaction snapshots. See Snapshot isolation.

Side effects

Automatic commit. Clears the Results tab in the Results pane in Interactive SQL. The DROP INDEX statement closes all cursors for the current connection.

If you use the DROP INDEX statement to drop an index on a local temporary table an Index not found error is returned. Use the DROP TABLE statement to drop a local temporary table. Indexes on local temporary tables are dropped automatically when the local temporary table goes out of scope.

See also
Standards and compatibility
  • SQL/2003   Core feature.

Example

Drop MyIndex from the database. If the index does not exist, an error is returned.

DROP INDEX MyIndex;