hello, i'm fairly new to oracle, but i pretty much get it. anyway i've created a table using this code :

create table BanquetReservation(
ResNo SMALLINT NOT NULL,
Restriction varchar(30) not null,
ResType varchar(10) not null,
DateOfEvent Date not null,
NoOfPeople SMALLINT NOT NULL,
EndDate Date,
StartDate Date,
SSN CHAR(9) NOT NULL,
BYear SMALLINT NOT NULL,
SID   SMALLINT  not null,
primary key (ResNo),
foreign key (SSN) REFERENCES Customer,
foreign key (BYear) REFERENCES Budget,
foreign key (SID) REFERENCES BanquetStaff);

and alls well, its just when i try to insert into the table:
Insert INTO BanquetReservation VALUES(100010,'None','Seminar','15-APR-04',400,'15-APR-04','1-APR-04',999887777,2004,12345);

i get this error message:
ORA-02291: integrity constraint (10212_S6.SYS_C00133029) violated - parent key not found

and i'm sure of the foreign keys that i used are the same type and that their already inserted into the other tables and everything,it says parent key not found but it is! can it mean smthg other than parent key not found?yeah and the little * that tells u where the problem is , is at the beginning under insert. so pls help.:)

Recommended Answers

All 3 Replies

hello, i'm fairly new to oracle, but i pretty much get it. anyway i've created a table using this code :

create table BanquetReservation(
ResNo SMALLINT NOT NULL,
Restriction varchar(30) not null,
ResType varchar(10) not null,
DateOfEvent Date not null,
NoOfPeople SMALLINT NOT NULL,
EndDate Date,
StartDate Date,
SSN CHAR(9) NOT NULL,
BYear SMALLINT NOT NULL,
SID   SMALLINT  not null,
primary key (ResNo),
foreign key (SSN) REFERENCES Customer,
foreign key (BYear) REFERENCES Budget,
foreign key (SID) REFERENCES BanquetStaff);

and alls well, its just when i try to insert into the table:
Insert INTO BanquetReservation VALUES(100010,'None','Seminar','15-APR-04',400,'15-APR-04','1-APR-04',999887777,2004,12345);

i get this error message:
ORA-02291: integrity constraint (10212_S6.SYS_C00133029) violated - parent key not found

and i'm sure of the foreign keys that i used are the same type and that their already inserted into the other tables and everything,it says parent key not found but it is! can it mean smthg other than parent key not found?yeah and the little * that tells u where the problem is , is at the beginning under insert. so pls help.:)

Use this query to find out which table/column is the one raising the error:

SELECT * FROM user_cons_columns
WHERE constraint_name = Upper('<constraint_name_goes_here>')

Once you know which table/column, do a query to verify that the value in you insert statement is indeed in the table.

SELECT * FROM user_cons_columns
WHERE constraint_name = Upper('demo_order_items1_fk')

yea thanx i think itll help. but i didnt create any constarints.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.