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
Explain what are synonyms used for?
How to create an oracle testing table?
What is the recommended interval at which to run statspack snapshots, and why?
What are a collation and state the different types of collation sensitivity?
What is the difference between truncate & delete command?
Can we store pictures in the database and if so, how it can be done?
Can you drop an index associated with a unique or primary key constraint?
What happens if you use a wrong connect identifier?
What is oracle rowcount?
What is concurrency in oracle?
How to define an anonymous procedure with variables?
How would you go about verifying the network name that the local_listener is currently using?
What language does oracle use?
Does facebook use oracle?
What is the difference between I and G in Oracle?