Andrew Biddle
Andrew Biddle

Reputation: 111

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 Syntax Error

Upvotes: 3

Views: 501

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562368

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.

Upvotes: 5

Related Questions