I'm trying to create the following table in SQL
create table Compra
(
CodCompra number(3) primary key,
DataCompra date,
DataEntrega date,
Fornecedor foreign key Fornecedor REFERENCES (codfornecedor)Fornecedor
)
ORA-00907: right parenthesis not found
When you remove " Fornecedor foreign key Fornecedor REFERENCES (codfornecedor)Fornecedor
" the table is created normally. And giving the command
alter table Compra
add foreign key (Fornecedor) references Fornecedor (Fornecedor)
It characterizes Fornecer
as an invalid identifier.
Note : The FORNECEDOR
table with the primary key CodFornecedor
has already been created.