Hi how Can I Add A Foreign key that references a table that
has composit primary key ?
example i had costumer table that has C_Id and SSN Both as
PK and another table has C_Id that must refernece C_Id in
Customers i done the usual way and got oracle error message
about uniqeness any ideas plz

Answers were Sorted based on User's Feedback



Hi how Can I Add A Foreign key that references a table that has composit primary key ? example i ..

Answer / manish yadav

Problem:I think you are challenging the concept of foriegn
key here, a forign key should be unique or primary key in
the refrenced table,C_ID in your case is part of composite
key i.e. its not primary key itself and nither unique key.

Solution:In customer table you may not want to change
primary key but if possible add unique constraint on C_ID
column. It should work

Is This Answer Correct ?    4 Yes 0 No

Hi how Can I Add A Foreign key that references a table that has composit primary key ? example i ..

Answer / mrs.priya

try to separate the composite key using str function when
referencing in another function to get only C_ID

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Oracle General Interview Questions

what is Materialized view? What is a snapshot? what are the similarities and differences between Materialized views and snapshots?

2 Answers  


What is the difference between Sleep and Wait? (Java)

1 Answers   RBS,


What is a read write transaction in oracle?

0 Answers  


what is primary key and foreign key when and where have to use

5 Answers  


create one table to capture an employee details with a primary key.

1 Answers   CTS,






Please explain the difference between outer join and inner join? With examples would be appreciable..!

6 Answers   IBM,


What are the tools for Oracle ?

0 Answers   Infosys,


Hi Can any one tell me what are the API's used in requisition import.

0 Answers  


What is a trigger and what are its types?

0 Answers  


How to delete multiple rows from a table in oracle?

0 Answers  


What are the differences between char and nchar in oracle?

0 Answers  


Define the terms primary key foreign key and also the difference between primary and the unique key

2 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • 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)