简体   繁体   中英

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. Can someone help point out the problem? I'm using SQL Developer (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" . But it's easier if you can spell your identifiers without whitespace or punctuation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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