0
votes

I am trying to create a table with a foreign key, but I keep on getting a missing keyword error. Any headers on what may be causing the problem?

 Create table CAR
(vin varchar2(7),
SaleDate date,
SalePrice number (7,2),
Balance_due number (7, 2),
date_bought date,
miles number(6), 
CONSTRAINT pkcar PRIMARY KEY(vin),
CONSTRAINT fkcar1 FOREIGN KEY(BrName) REFRENCES BRANCH,
CONSTRAINT fkcar4 FOREIGN KEY(CarTypeCode) REFRENCES CARTYPE,
CONSTRAINT fkcar2 FOREIGN KEY(BuyerId) REFRENCES CUSTOMER,
CONSTRAINT fkcar3 FOREIGN KEY(SellerId) REFRENCES CUSTOMER);

The error reads: Error at line 9: ORA-00905:missing keyword

I have already created the other tables (BRANCH, CARTYPE, CUSTOMER) and set their primary keys as (BrName, CarTypeCode, CustId).

2
REFRENCES should be references i guess .. - ashutosh raina

2 Answers

4
votes

REFRENCES is spelled REFERENCES

0
votes

REFRENCES should be references i guess .. and you are not specifying the column of the parent table CONSTRAINT fk_column FOREIGN KEY (column1, column2, ... column_n) REFERENCES parent_table (column1, column2, ... column_n)