Collections:
ALTER INDEX - 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
⇒ Drop an Existing Index in Oracle
⇐ CREATE INDEX - Create a Table Index in Oracle
2020-02-20, 1901🔥, 0💬
Popular Posts:
How to change the data type of an existing column with "ALTER TABLE" statements in SQL Server? Somet...
What is test testing area for? The testing area is provided to allow visitors to post testing commen...
How AdventureWorksLT tables are related in SQL Server? There are 12 user tables defined in Adventure...
Can Date and Time Values Be Converted into Integers in SQL Server Transact-SQL? Can date and time va...
What Are Bitwise Operations in SQL Server Transact-SQL? Bitwise operations are binary operations per...