简体   繁体   English

SQL 语法错误:“缺少右括号”

[英]SQL Syntax Error: “Missing Right Parenthesis”

I understand the ORA-00907 is indicating that I have a syntax error in my code, I just can't find it.我知道 ORA-00907 表明我的代码中有语法错误,我只是找不到它。 Can someone help point out the problem?有人可以帮忙指出问题吗? I'm using SQL Developer (Oracle12c).我正在使用 SQL 开发人员(Oracle12c)。

CREATE TABLE equip 
  (equipid NUMBER(3),
   edesc VARCHAR2(30), 
   purchdate DATE, 
   rating CHAR(1), 
   deptid NUMBER(2) NOT NULL, 
   etypeid NUMBER(2),
    CONSTRAINT equip_equipid_pk PRIMARY KEY (equipid),
    CONSTRAINT equip deptid_fk FOREIGN KEY (deptid) REFERENCES dept (deptid),
    CONSTRAINT equip_etypeid_fk FOREIGN KEY (etypeid) REFERENCES etypes (etypeid),
    CONSTRAINT equip_rating_ck CHECK (rating IN ('A','B','C')));

Oracle12 SQL 语法错误

You have a space in the constraint name, which is probably confusing the syntax parser:约束名称中有一个空格,这可能会使语法解析器感到困惑:

CONSTRAINT equip deptid_fk FOREIGN KEY (deptid) REFERENCES dept (deptid),
                ^

If you need a space in identifiers, delimit them in double-quotes like "equip deptid_fk" .如果您需要标识符中的空格,请将它们用双引号分隔,例如"equip deptid_fk" But it's easier if you can spell your identifiers without whitespace or punctuation.但是,如果您可以在没有空格或标点符号的情况下拼写您的标识符,那就更容易了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM