The hosue_key may not be having the values that is not present in
oil_housetype.
You have not assigned the name of the column in refrenced table.
Example :
ALTER TABLE DEPFTDINT ADD (
CONSTRAINT DEPFTDINT_STAFFMAST_USRSP_FK FOREIGN KEY (DEPUSRSP)
REFERENCES STAFFMAST (STAFFNO));
Regards,
Sushil Kumar,
Canara Bank,
SUSG, DIT - Wing,
Bangalore,
Karnataka - 560 001.
----- Original Message -----
From: "Dave " <oracledba-ezmlmshield-x77369211.[Email address protected]
To: "LazyDBA Discussion" <[Email address protected]
Sent: Wednesday, October 31, 2007 5:27 AM
Subject: Problem assigning a foreign key
> I'm trying to set a foriegn key in a table that has the same column name
> as another table where that column name in the other table has already
> been set as the primary key, but I got an error:
>
> ALTER TABLE oil_customers
> ADD CONSTRAINT housetype_oil_customers_fk FOREIGN KEY(housetype)
> REFERENCES oil_housetype;
>
> ERROR at line 2:
> ORA-02298: cannot validate (SCOTT.HOUSETYPE_OIL_CUSTOMERS_FK) - parent
> keys not found
>
> Could this be because of the underscores? I know that the underscore that
> comes right after 'housetype' is part of the code, and also the one coming
> right before 'fk', but by co-incidence, I had already named the table
> 'oil_customers' some time ago. Is that underscore in oil_customers
> confusing SQL ?
> If I rename all the tables to eliminate the underscore in their names,
> wont that screw up other things?
> Thanks.
>
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> To post a dba job: http://jobs.lazydba.com
> To Subscribe : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
>
>
>
DISCLAIMER: This email may contain privileged information and is intended solely for the addressee, and any disclosure of this information is strictly prohibited, and may be unlawful. If you have received this mail by mistake, please inform the sender immediately and delete this mail. Any information expressed in this mail does not necessarily reflect the views of CANARA BANK. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the Bank. The recipient should check this email and any attachments for the presence of viruses. The sender declares that no liability can be cast upon the sender for any error or omissions in the contents of the message that arise, as a result of e-mail transmission and further declares that the sender cannot be made liable for any loss suffered by any person, on account of having acted upon any messages which is vitiated by error, omissions or interception.
Oracle LazyDBA home page