Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how do u setup a replication site?

1937


How to use subqueries in the from clause in oracle?

1059


What are the differences between char and nchar in oracle?

1032


What to do if the binary spfile is wrong for the default instance?

1014


What are the logical operations?

1073


What happens if the update subquery returns multiple rows?

1062


How do I uninstall oracle client from windows?

971


Difference between open_form and call_form in oracle.

1106


Are truncate and delete commands same? If so why?

1092


How to convert dates to characters in oracle?

996


What happens if you lost a data file?

990


Explain the difference between sql and oracle?

1038


How to start an oracle instance?

963


How to open a cursor variable?

986


What is bulk collect in oracle?

964