ALTER INDEX statement

Description

Renames indexes and foreign key role names of indexes and foreign keys explicitly created by a user.

Syntax

Syntax 1

ALTER INDEX index-name rename-spec 

Syntax 2

ALTER [ INDEX ] FOREIGN KEY role-name rename-spec 

Parameters

rename-spec:

ON [ owner.]table-name RENAME [ AS | TO ] new-name

Examples

Example 1

The following statement renames an index COL1_HG_OLD in the table jak.mytable to COL1_HG_NEW.

ALTER INDEX COL1_HG_OLD ON jak.mytable 
RENAME AS COL1_HG_NEW

Example 2

The following statement renames a foreign key role name ky_dept_id in table dba.employee to emp_dept_id.

ALTER INDEX FOREIGN KEY ky_dept_id
ON dba.employee 
RENAME TO emp_dept_id

Usage

The ALTER INDEX statement renames indexes and foreign key role names of indexes and foreign keys that were explicitly created by a user. Note that indexes created to enforce key constraints cannot be renamed.

ON clause The ON clause specifies the name of the table which contains the index or foreign key to rename.

RENAME [ AS | TO ] clause The RENAME clause specifies the new name of the index or foreign key role.


Side Effects

Automatic commit. Clears the Results tab in the Results pane in Interactive SQL. Closes all cursors for the current connection.

Standards

Permissions

Must own the table, or have REFERENCES permissions on the table, or have DBA authority.

See also