Please help me how to write a Query to change the primary
key constraint from 1 attribute to another attribute in a
table
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / chandana
YOU CANNOT CHANGE THE CONSTRAINTS DIRECTLY ON A COLUMN.
FIRST DROP THE CONSTARINT U HAVE CREATED AND THEN USE ALTER
COMMAND TO ADD CONSTARINT TO THE CORRECT COLUMN.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / manvendra
ALTER TABLE TABLE_NAME
MODIFY COLUMN (COLUMN2 PRIMARY KEY);
| Is This Answer Correct ? | 1 Yes | 5 No |
what is exact difference between drop and truncate table.
How to change system global area (sga) in oracle?
how to i write the query 'NISHI' TO N I S H I
4 Answers Attra, Metric Stream,
15. Display the item_cost and then truncate it to the nearest hundred, ten, unit, tenth and hundredth.
What is the purpose of init.ora. ? how many init.ora exist in oracle installation? suppose there are 3 database on one oracle server, how many init.ora do I have? what are various database objects? how will you identify memmory related performace issue in oralce? any idea about basic architure difference of oracle and db2? comment on which is better , with reasons? what is a fuction based index? is it recommended to use the same. ? what is global temporay table? what is teh signification of the parameter session_cached_cursor ?
What is the disadvantage of User defind function?
Explain what does a control file contain?
When can Hash Cluster used ?
How would you best determine why your MVIEW couldnt FAST REFRESH?
In AP we done Customizations for Late Payments Charges. For Reporting Purpose What are the Documents Prepared for Customer Understanding??
What is Water Mark in Oracle?
What are the different types of databases?