Please help me how to write a Query to change the primary
key constraint from 1 attribute to another attribute in a
table
Answer Posted / dinesh a.
You can assing only one primary key on a table , so you
can't modify directoly one column to another , you need to
drop first one then create on another attribute.
SQL>ct constraint_name,constraint_type from user_constraints
where table_name='EMP' and constraint_type='P';
CONSTRAINT_NAME C
------------------------------ -
SYS_C00125220 P
SQL> alter table emp drop constraint SYS_C00125220;
sql> alter table any_table add constraint my_cons_nm
primary key(column_of_tab)
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
how do u setup a replication site?
How to use subqueries in the from clause in oracle?
What are the differences between char and nchar in oracle?
What to do if the binary spfile is wrong for the default instance?
What are the logical operations?
What happens if the update subquery returns multiple rows?
How do I uninstall oracle client from windows?
Difference between open_form and call_form in oracle.
Are truncate and delete commands same? If so why?
How to convert dates to characters in oracle?
What happens if you lost a data file?
Explain the difference between sql and oracle?
How to start an oracle instance?
How to open a cursor variable?
What is bulk collect in oracle?