Collections:
Rename an Index in Oracle
How To Rename an Index in Oracle?
✍: FYIcenter.com
Let's say you have an existing index, and you don't like its name anymore for some reason, you can rename it with the ALTER INDEX ... RENAME TO statement. Here is an example script on how to rename an index:
CREATE TABLE student (id NUMBER(5) PRIMARY KEY, first_name VARCHAR(80) NOT NULL, last_name VARCHAR(80) NOT NULL, birth_date DATE NOT NULL, social_number VARCHAR(80) UNIQUE NOT NULL); Table created. SELECT index_name, table_name, uniqueness FROM USER_INDEXES WHERE table_name = 'STUDENT'; INDEX_NAME TABLE_NAME UNIQUENES ----------------------- --------------------- --------- SYS_C004153 STUDENT UNIQUE SYS_C004154 STUDENT UNIQUE ALTER INDEX SYS_C004153 RENAME TO student_pk; Statement processed. SELECT index_name, table_name, uniqueness FROM USER_INDEXES WHERE table_name = 'STUDENT'; INDEX_NAME TABLE_NAME UNIQUENES ----------------------- --------------------- --------- STUDENT_PK STUDENT UNIQUE SYS_C004154 STUDENT UNIQUE
⇐ Indexes for the PRIMARY KEY Column in Oracle
2019-05-01, 1383👍, 0💬
Popular Posts:
How To Get the Definition of a Stored Procedure Back in SQL Server Transact-SQL? If you want get the...
What Happens If the Imported Table Already Exists in Oracle? If the import process tries to import a...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...
Where to find answers to frequently asked questions I am new to Oracle database. Here is a list of f...
How To Drop an Index in Oracle? If you don't need an existing index any more, you should delete it w...