SQL错误缺少右括号

时间:2018-03-28 18:38:48

标签: sql oracle

我是SQL新手,我正在为课程做作业。我不明白下面的陈述有什么问题。

CREATE TABLE APP_DEGREE 
    (DEGREE_ID varchar (6) NOT NULL,
    TITLE varchar (3O), 
    INSTITUTION varchar (30), 
    App_ID varchar (6) NOT NULL,
    CONSTRAINT constr_degree_pk PRIMARY KEY (DEGREE_ID), 
    CONSTRAINT constr_degree_fk FOREIGN KEY (App_ID) REFERENCES APPLICANT (App_ID)
    );

当我运行脚本时,我收到此错误:

Error report -
ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:

感谢您的帮助!

2 个答案:

答案 0 :(得分:4)

错字:TITLE varchar(30)而不是TITLE varchar(3O)

答案 1 :(得分:1)

CREATE TABLE APP_DEGREE(
    DEGREE_ID varchar(6) NOT NULL,
    TITLE varchar(30), 
    INSTITUTION varchar(30), 
    App_ID varchar(6) NOT NULL,
    CONSTRAINT constr_degree_pk PRIMARY KEY(DEGREE_ID), 
    CONSTRAINT constr_degree_fk FOREIGN KEY(App_ID) REFERENCES APPLICANT(App_ID)
);

编辑:" O"相反" 0"。使用IDE,您将立即看到此类错误。还有"`"字符串分隔符,以便不处理保留的sql关键字,如" order"作为字段名称。