dcsimg
Results 1 to 2 of 2

Thread: Error: ORA-02270 | Help Needed

Hybrid View

  1. #1
    Join Date
    Mar 2015
    Posts
    1

    Exclamation Error: ORA-02270 | Help Needed

    I'm having a headache over this error:
    SQL Error: ORA-02270: no matching unique or primary key for this column-list
    02270. 00000 - "no matching unique or primary key for this column-list"

    Someone save me from this agony and tell me what's wrong with my code.

    Code:
    CREATE TABLE Concert
    (   CDate          DATE NOT NULL,
        StartTime      TIMESTAMP NOT NULL,
        VHall          VARCHAR2(20) NOT NULL,
        FinnishTime    TIMESTAMP NOT NULL,
        OName          VARCHAR2(15) NOT NULL,
        OFee           DECIMAL(19,4) NOT NULL,
        PRIMARY KEY (CDate, StartTime, VHall),
        FOREIGN KEY (VHall) REFERENCES Venue(VHall),
        FOREIGN KEY (OName) REFERENCES Orchestra(OName) ) ;
    Code:
    CREATE TABLE ConcertStandin
    (   CDate          DATE NOT NULL,
        StartTime      TIMESTAMP NOT NULL,
        VHall          VARCHAR2(20) NOT NULL,
        MNo            VARCHAR2(15) NOT NULL,
        StandinFee     DECIMAL(19,4) NOT NULL,
        PRIMARY KEY (CDate, StartTime, VHall, MNo),
        FOREIGN KEY (CDate) REFERENCES Concert(CDate),
        FOREIGN KEY (StartTime) REFERENCES Concert(StartTime),
        FOREIGN KEY (VHall) REFERENCES Venue(VHall),
        FOREIGN KEY (MNo) REFERENCES Musician(MNo) ) ;

    Thanks in advance.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,911
    When you create a foreign key the table/column you reference must be either primary key or unique key.

Posting Permissions

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