Home » SQL & PL/SQL » SQL & PL/SQL » Help pls ...Unique constraint and Foreign Key
Help pls ...Unique constraint and Foreign Key [message #37479] |
Mon, 11 February 2002 10:16 |
laj
Messages: 2 Registered: February 2002
|
Junior Member |
|
|
I quite new to SQLPLus, I've tried to read other question about this that is quite similar, but somehow I cant solve my problem...the error msg is ORA-00291- integrity constraint violated - parent key not found.
(I already key in all my parent column). Here is my table ..
CREATE TABLE Flight
(airlineName varchar(20) not null,
flightNo varchar(20) not null unique,
origin varchar(40) not null,
dest varchar(40) not null,
departDate date,
arrivalDate date,
departTime char(20),
duration char(20),
Primary Key (flightNo,departDate));
Create Table Price
(priceId char(5) not null unique,
tripType char(5),
fareType char(5),
price number(10),
Primary Key (priceId));
CREATE TABLE Customer
(custId varchar(20) not null unique,
PIN varchar(20) not null,
lastName char(25),
firstName char(25),
emailAdd char(20),
contact number(10),
creditCardNo number(25),
Primary key (custId));
Create Table Booking
(
bookingId number(5) not null unique,
custId varchar(20) not null,
departFlightNo varchar(20) not null,
returnFlightNo varchar(20),
priceId char(2) not null,
dateOfPurchase date,
departDate date,
returnDate date,
FOREIGN KEY(departFlightNo,departDate) REFERENCES Flight
FOREIGN KEY(returnFlightNo,departDate) REFERENCES Flight
FOREIGN KEY(custId) REFERENCES Csutomer
FOREIGN KEY(PriceId) REFERENCES Price
);
I know the problem is with my BOOKING table, especially in the Foreign key and Unique constratin in the other table (i need them to be unique)..
Problem when I key in Booking row,
insert into Booking values ('1','c1','AA213','AA214','Q','21-DEC-01','03-JAN-02','10-JAN-02');
Anybody ?? ... thx in advance =)
|
|
|
|
|
Goto Forum:
Current Time: Sat Sep 28 15:47:16 CDT 2024
|