Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Foreign key access problem

 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have two tables table1 and table2. I have 3 fields in each tables. I made two of the fields in table1 as composite primary key. Now, I want to make one among these fields as foreign key to table2. When I give like this and try to run, I'm getting an error like

SQL> Error Message: The Foreign Key TABLE1_0_SYSTEMNAMEDCONSTRAINT_TABLE2_FOREIGNKEY_NAME does not map to a primary key in table TABLE2. Each foreign key must reference a table that has a primary key made up of the same columns as specified in the reference list.


Here, I want to make that field(one among the composite primary key participants) as foreign key in my table2. Is it possible? If so how?


Thanks in advance,
Narendranath.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Narendranath,
It is possible to do that. Do you have a one field primary key on table 2? Is it the same datatype?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic