Here we are going to see how we can drop primary key and keep index meaning without touch index
- If add primary key on column the automatically create unique index
SQL>create table test1
(id number constraints test1_id_pk primary key,name varchar2(20));
SQL> select constraint_name,constraint_type from user_constraints where table_
name='TEST1';
CONSTRAINT_NAME C
------------------------------ -
TEST1_ID_PK P
SQL> select index_name from user_indexes where table_name='TEST1';
INDEX_NAME
------------------------------
TEST1_ID_PK
SQL> alter table test1 drop primary key keep index;
Table altered.
SQL> select constraint_name,constraint_type from user_constraints where table_
name='TEST1';
no rows selected
SQL> select index_name from user_indexes where table_name='TEST1';
INDEX_NAME
------------------------------
TEST1_ID_PK
25% OFF on Oracle Apps R12 Financials Self Paced Course along with 11 Additional Add On Courses (321 Session Videos of 120 Hours Recordings). Our Top Trending Course with 1700 Enrolled Udemy Students
ReplyDeletePlease Check https://www.oracleappstechnical.com for details