2017-04-25 3 views
0
CREATE TABLE Booking (
Name varchar2(30) NOT NULL, 
R_date date NOT NULL, 
D_address varchar2(30) NOT NULL, 
Email_id varchar2(30) NOT NULL, 
No_of_cars int NOT NULL, 
Contact_no varchar2(15) NOT NULL, 
Price int NOT NULL, 
CONSTRAINT FK_CarBooking FOREIGN KEY (C_ID) 
REFERENCES Car(C_ID) 
); 

CONTRAINTE FK_CarBooking FOREIGN KEY (C_Id)erreur Oracle clé étrangère identifiant invalide

ERROR at line 10: 
ORA-00904: "C_ID": invalid identifier 

Dans le tableau de voiture C_Id est la clé primaire. Je ne comprends pas pourquoi c'est un identifiant invalide.

+0

Il n'y a pas de colonne 'c_id' dans la table' booking'. –

Répondre

0
CONSTRAINT FK_CarBooking FOREIGN KEY (C_ID) 
REFERENCES Car(C_ID) 

La première C_Id doit exister dans la table Réservation et la seconde dans la table de voiture.

Afin de résoudre ce problème, ajoutez un champ nommé C_ID dans la table Booking.