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 to write a query with a left outer join in oracle?

1123


How to convert characters to dates in oracle?

1148


What is literal?

1062


What happens to the data files if a tablespace is dropped?

1106


Explain about integrity constraint?

1176


Can we commit inside a function in oracle?

1010


What are the uses of a database trigger?

1035


What are the attributes that are found in a cursor?

1118


In oracle there is column command, how will you explain that?

1135


How to get a list of all background sessions in the database?

1036


State and explain about oracle instance?

1049


What are nested tables?

1225


What is a subquery in oracle?

1163


How remove data files before opening a database?

1132


How to pass a cursor variable to a procedure?

1153