RE: Problem assigning a foreign key

RE: Problem assigning a foreign key

 

  

[[Email Address Removed] ~]$ oerr ora 2298
02298, 00000,"cannot validate (%s.%s) - parent keys not found"
// *Cause: an alter table validating constraint failed because the table has
// orphaned child records.
// *Action: Obvious

-----Original Message-----
From: Dave [mailto:oracledba-ezmlmshield-x77369211.[Email address protected]
Sent: Tuesday, October 30, 2007 4:58 PM
To: LazyDBA Discussion
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




Oracle LazyDBA home page