Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    1

    Unanswered: Error in Create table command help

    SQL> CREATE TABLE TEAMSTADIUMS
    2 (
    3 S_Id INT NOT NULL PRIMARY KEY,
    4 S_NAME VARCHAR(20),
    5 T_ID INT FOREIGN KEY REFERENCES MLBTEAMS(T_ID)
    6 );
    T_ID INT FOREIGN KEY REFERENCES MLBTEAMS(T_ID)
    *
    ERROR at line 5:
    ORA-00907: missing right parenthesis

    cannot for the life of me figure out where the other right parenthesis goes, i am pretty new to SQL. thank you for your help!!

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    It goes *nowhere*; syntax you used is wrong (and the error message is somewhat misleading).

    Code:
    SQL> create table mlbteams (t_id int primary key);
    
    Table created.
    
    SQL> create table teamstadiums
      2    (s_id     int    not null   primary key,
      3     s_name   varchar2(20),
      4     t_id     int    constraint fk_stte
      5                       references mlbteams (t_id)
      6    );
    
    Table created.
    
    SQL>

  3. #3
    Join Date
    Apr 2012
    Posts
    7
    May be t_id is not set as a primary key for MLBTEAMS.
    Please confirm it

Posting Permissions

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