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
List out the difference between commit, rollback, and savepoint?
How to add another datafile to a tablespace?
How to load excel data sheet to oracle database
Can we create trigger on materialized view in oracle?
how to do daily transactions with out sql* loader control file regesterd in apps?
what is the difference between substr and instr function in oracle?
What is a trace file and how is it created in oracle?
What is ASM (Automatic Storage Management) in Oracle?
Explain database link?
What is the difference between translate and replace in oracle?
How to convert characters to numbers in oracle?
What is a lookup table in oracle?
Why do I get unexpected characters from 8-bit character sets in weblogic jdriver for oracle?
What operating systems are supported by oracle database 10g xe?
What are dml statements in oracle?