Oracle数据库括号错误

时间:2015-10-05 07:32:24

标签: database oracle

我正在尝试查找此查询中的错误,但我找不到括号错误。他们看起来对我不对。错误代码是:

ORA-00907: missing right parentheses

以下是查询:

CREATE TABLE GRADE
(
    COURSE_NO VARCHAR(100),
    STUDENT_ID VARCHAR(100),
    GRADE VARCHAR(1),
    PRIMARY KEY (COURSE_NO, STUDENT_ID)
    FOREIGN KEY (COURSE_NO)
    REFERENCES COURSE(COURSE_NO),
    FOREIGN KEY (STUDENT_ID)
    REFERENCES STUDENT(STUDENT_ID),
    FOREIGN KEY (GRADE)
    REFERENCES GRADE_POINT (GRADE)
);

1 个答案:

答案 0 :(得分:2)

此行中缺少逗号:

PRIMARY KEY (COURSE_NO, STUDENT_ID)

您的SQL必须是:

CREATE TABLE GRADE
(
COURSE_NO VARCHAR(100),
STUDENT_ID VARCHAR(100),
GRADE VARCHAR(1),
PRIMARY KEY (COURSE_NO, STUDENT_ID),
FOREIGN KEY (COURSE_NO)
REFERENCES COURSE(COURSE_NO),
FOREIGN KEY (STUDENT_ID)
REFERENCES STUDENT(STUDENT_ID),
FOREIGN KEY (GRADE)
REFERENCES GRADE_POINT (GRADE)
);