Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Unanswered: Error ORA-00907: missing right parenthesis

    Just learning SQL, following the text book exactly. Here is my code, and then the output. Thanks for any help. Pls note I have confirmed all the referenced tables exist and have data in them.


    CREATE TABLE assignment(
    ProjectID Integer Not Null
    FOREIGN KEY REFERENCES PROJECT (ProjectID),
    EmployeeNum Integer Not Null,
    HoursWorked Numeric (5,2) Default 10,
    CONSTRAINT AssignmentPK PRIMARY KEY (ProjectID, EmployeeNum),
    FOREIGN KEY (EmployeeNum) REFERENCES EMPLOYEE (EmployeeNumber));



    >>>>>>>>>>>>>>>>>
    *
    ERROR at line 3:
    ORA-00907: missing right parenthesis

  2. #2
    Join Date
    May 2003
    Location
    France
    Posts
    112

    Re: Error ORA-00907: missing right parenthesis

    Your first foreign key "PROJECT" has no name.

    CREATE TABLE assignment(
    ProjectID Integer Not Null
    FOREIGN KEY REFERENCES PROJECT (ProjectID),
    EmployeeNum Integer Not Null,
    HoursWorked Numeric (5,2) Default 10),
    CONSTRAINT AssignmentPK PRIMARY KEY (ProjectID, EmployeeNum),
    FOREIGN KEY (EmployeeNum) REFERENCES EMPLOYEE (EmployeeNumber);



    Originally posted by floop
    Just learning SQL, following the text book exactly. Here is my code, and then the output. Thanks for any help. Pls note I have confirmed all the referenced tables exist and have data in them.


    CREATE TABLE assignment(
    ProjectID Integer Not Null
    FOREIGN KEY REFERENCES PROJECT (ProjectID),
    EmployeeNum Integer Not Null,
    HoursWorked Numeric (5,2) Default 10,
    CONSTRAINT AssignmentPK PRIMARY KEY (ProjectID, EmployeeNum),
    FOREIGN KEY (EmployeeNum) REFERENCES EMPLOYEE (EmployeeNumber));



    >>>>>>>>>>>>>>>>>
    *
    ERROR at line 3:
    ORA-00907: missing right parenthesis

  3. #3
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up Re: Error ORA-00907: missing right parenthesis

    Hi,

    U have to place a comma at the end of 'ProjectID Integer Not null'. In the CREATE TABLE command all the columns are seperated by COmmas. SO place a comma after the first column. Altered code is given below :


    CREATE TABLE assignment(
    ProjectID Integer Not Null,
    FOREIGN KEY REFERENCES PROJECT (ProjectID),
    EmployeeNum Integer Not Null,
    HoursWorked Numeric (5,2) Default 10,
    CONSTRAINT AssignmentPK PRIMARY KEY (ProjectID, EmployeeNum),
    FOREIGN KEY (EmployeeNum) REFERENCES EMPLOYEE (EmployeeNumber));
    SATHISH .

  4. #4
    Join Date
    Oct 2003
    Posts
    22

    Re: Error ORA-00907: missing right parenthesis

    i am not sure but try using the key-word CONSTRAINT befor the second FOREIGN KEY key-word.

  5. #5
    Join Date
    May 2011
    Posts
    1

    missing right parenthesis

    create table personnel(p_id integer(20),lastname varchar2(55),firstname varchar2(55),address varchar2(200),city varchar2(70),constraint ck_pid check(p_id));

    create table personnel(p_id integer(20)....
    *
    error at line 1: missing right parenthesis

    can anyone help me resolve this problem

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    invalid syntax
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  7. #7
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Hint 1: check valid Oracle data types (and their precision)
    Hint 2: what are you checking with this constraint?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •