Home > Back-end >  I am using Oracle SQL Developer and it says I am "missing left parenthesis", but I don
I am using Oracle SQL Developer and it says I am "missing left parenthesis", but I don

Time:09-12

create table BookChe (
check number(10) not null,
bookISBN number(13) not null,
bookCopy number(10) not null,
constraint pk_ResChe primary key (check, bookISBN, bookCopy),
constraint fk_ResChe_Che foreign key (check) references checkout,
constraint fk_ResChe_book foreign key (bookISBN, bookCopy) references book
);

CodePudding user response:

check is a reserved word. Don't use it without double-quotes. If we change it for example to check_col, it works fine:

create table BookChe (
check_col number(10) not null,
bookISBN number(13) not null,
bookCopy number(10) not null,
constraint pk_ResChe primary key (check, bookISBN, bookCopy),
constraint fk_ResChe_Che foreign key (check) references checkout,
constraint fk_ResChe_book foreign key (bookISBN, bookCopy) references book
);

And example with double-quotes:

create table BookChe (
"CHECK" number(10) not null,
bookISBN number(13) not null,
bookCopy number(10) not null,
constraint pk_ResChe primary key ("CHECK", bookISBN, bookCopy),
constraint fk_ResChe_Che foreign key ("CHECK") references checkout,
constraint fk_ResChe_book foreign key (bookISBN, bookCopy) references book
);
  • Related