Home » Developer & Programmer » Designer » Errors when altering tables ro create foreign keys
Errors when altering tables ro create foreign keys [message #90530] Tue, 27 January 2004 09:47 Go to next message
Paul
Messages: 164
Registered: April 1999
Senior Member
hi! im having the following problem - when i type in the following to alter my tables to include foreign keys i get the following message

SQL> alter table comp_products
  2  add constraint comp_products_Mrkt_Seg_Id_fk foreign key(Mrkt_Seg_Id) references Mrkt_Segment(Mr
kt_Seg_Id);
add constraint comp_products_Mrkt_Seg_Id_fk foreign key(Mrkt_Seg_Id) references Mrkt_Segment(Mrkt_Se
               *
ERROR at line 2:
: cannot validate (100.COMP_PRODUCTS_MRKT_SEG_ID_FK) - parent keys not found

 

is this because my fields have the same name or is it something else? would greatly appreciate the help!
Re: Errors when altering tables ro create foreign keys [message #90535 is a reply to message #90530] Tue, 27 January 2004 13:21 Go to previous message
William Robertson
Messages: 1643
Registered: August 2003
Location: London, UK
Senior Member
It is saying that the FK would be invalid because there are records in COMP_PRODUCTS where MRKT_SEG_ID does not exist in MRKT_SEGMENT.
Previous Topic: Sizing the SGA components prior to going into production
Next Topic: Design the data structure of a database
Goto Forum:
  


Current Time: Thu Mar 28 15:01:16 CDT 2024