我正在使用Oracle SQL Developer,它说我“缺少左圆括号”,但我看不出代码有什么问题

enxuqcxy  于 2022-09-18  发布在  Java
关注(0)|答案(1)|浏览(137)
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
);
dxxyhpgq

dxxyhpgq1#

check是保留字。不要使用没有双引号的它。例如,如果我们将其更改为check_col,则它可以正常工作:

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
);

和带双引号的示例:

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
);

相关问题