aspose file tools*
The moose likes JDBC and the fly likes Foreign key access problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Foreign key access problem" Watch "Foreign key access problem" New topic
Author

Foreign key access problem

Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

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.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30929
    
158

Narendranath,
It is possible to do that. Do you have a one field primary key on table 2? Is it the same datatype?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Foreign key access problem