Home » SQL & PL/SQL » SQL & PL/SQL » want to enable constraint (pk-fk)
want to enable constraint (pk-fk) [message #7996] Mon, 21 July 2003 11:35 Go to next message
swati
Messages: 7
Registered: May 2001
Junior Member
i have one table programs with primary key on program_code and another table programsdetails with program_code field with check constraint n also with records. now my query is to declare foreign key on program_code of programsdetails.for that i give the command "alter table programsdetails add constraint s1 foreign key(program_code) references programs;" but, i got error message like parent key not found. but i had already given that. so, plz help me out to define a foreign key on a table who has already existing records .
Re: want to enable constraint (pk-fk) [message #7997 is a reply to message #7996] Mon, 21 July 2003 13:22 Go to previous message
wrbalaji
Messages: 11
Registered: February 2003
Junior Member
hi,

The problem might be with the records you have. Please check whether Program_code records in Programdetails table are available in program_code in Program table. You might miss a record or more. This could be a probability for your error.

best of luck..

balaji.
Previous Topic: UPDATE-CLAUSE
Next Topic: procedure problem
Goto Forum:
  


Current Time: Thu Apr 25 22:28:39 CDT 2024