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 to write a query with a left outer join in oracle?
How to convert characters to dates in oracle?
What is literal?
What happens to the data files if a tablespace is dropped?
Explain about integrity constraint?
Can we commit inside a function in oracle?
What are the uses of a database trigger?
What are the attributes that are found in a cursor?
In oracle there is column command, how will you explain that?
How to get a list of all background sessions in the database?
State and explain about oracle instance?
What are nested tables?
What is a subquery in oracle?
How remove data files before opening a database?
How to pass a cursor variable to a procedure?