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

Answers were Sorted based on User's Feedback



Please help me how to write a Query to change the primary key constraint from 1 attribute to anoth..

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

Please help me how to write a Query to change the primary key constraint from 1 attribute to anoth..

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

Please help me how to write a Query to change the primary key constraint from 1 attribute to anoth..

Answer / manvendra

ALTER TABLE TABLE_NAME
MODIFY COLUMN (COLUMN2 PRIMARY KEY);

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More Oracle General Interview Questions

Hi Masters, in Oracle Applications 11i, we hace 2 functions using the same form, i need to create 1 personalization, but that code must afect only one function.... how can i do that?

0 Answers  


What is the difference between implicit index and explicit index?

2 Answers   TCS,


nw i'm doing MBA system and planning to do oracle,database management.tell me that whether it is useful r not?.refer any course for my carrier pls

0 Answers  


What are advantages of dateset in datastage?

0 Answers   iGate,


Is it possible to join two tables, that are in two different users (e.g. SCOTT and HR etc.),but im same database (e.g. ORCL)? If yes, then how it is possible? Explain with step by step procedure.

1 Answers   IBM,


If server is in US and client is in india there is timezone is diffrence, How can we display date in indian time when data is displayed from US server timezone?

1 Answers  


Difference between primary key and unique key ?

77 Answers   Accenture, B2B Software Technologies, Cognizant, HP Finsoft, IndiaNIC, Karomi Technology, Keane India Ltd, L&T, Onward eServices, R Systems, Shakti, Techtic Solutions,


what is load balancing and what u have used to do this?(sql loader)

3 Answers  


Hi this srilatha. I comlpeted my Oracle-hrms. can u provide me interview questions on Core hr, payroll,sshr,OLM etc..

0 Answers  


What are inner join and outer join?

3 Answers  


IS it possible to built the oracle database without setting the kernal parameters?

0 Answers   EDS,


What is the difference between "as" and "is" in an oracle stored procedure?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)