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

Explain what are synonyms used for?

981


How to create an oracle testing table?

1006


What is the recommended interval at which to run statspack snapshots, and why?

2860


What are a collation and state the different types of collation sensitivity?

1092


What is the difference between truncate & delete command?

1123


Can we store pictures in the database and if so, how it can be done?

982


Can you drop an index associated with a unique or primary key constraint?

967


What happens if you use a wrong connect identifier?

979


What is oracle rowcount?

1034


What is concurrency in oracle?

946


How to define an anonymous procedure with variables?

1060


How would you go about verifying the network name that the local_listener is currently using?

1994


What language does oracle use?

1046


Does facebook use oracle?

979


What is the difference between I and G in Oracle?

1017