1 Reply Latest reply: Nov 30, 2012 10:01 AM by rp0428 RSS

    no matching unique or primary key for this column-list

    975396
      CREATE TABLE CUSTOMER(CUS_NUM NUMBER(10) PRIMARY KEY,CUS_NAME VARCHAR2(50),ADDRESS VARCHAR2(50));

      CREATE TABLE ITEM(ITEM_NUM NUMBER(10),ITEM_DESC VARCHAR2(50),TYPE VARCHAR2(50),ITEM_STATUS VARCHAR2(50),
      CONSTRAINT PK_ITEM PRIMARY KEY(ITEM_NUM,TYPE));

      CREATE TABLE ITEM_TYPE(TYPE VARCHAR2(50) PRIMARY KEY,TYPE_NAME VARCHAR2(50),SKU VARCHAR2(50),RATING VARCHAR2(50));

      CREATE TABLE ORDERS(ORDER_NUMBER NUMBER(10),CUS_NUM NUMBER(10),ITEM_NUM NUMBER(10),ORDER_POINT VARCHAR2(50),DISPATCH_POINT VARCHAR2(50),
      PRIORITY VARCHAR2(50),ORDER_STATUS VARCHAR2(50),
      CONSTRAINT PK_ORDERS PRIMARY KEY(ORDER_NUMBER,ITEM_NUM),
      CONSTRAINT FK1_ORDERS FOREIGN KEY (CUS_NUM) REFERENCES CUSTOMER(CUS_NUM),
      CONSTRAINT FK2_ORDERS FOREIGN KEY (ITEM_NUM) REFERENCES ITEM(ITEM_NUM));

      Hi,friends i created tables as above when i creating 'ORDERS' table the error will fir as "ORA-02270: no matching unique or primary key for this column-list".
      can any body solve this issue.

      Cheers,
      Sudhir reddy.
        • 1. Re: no matching unique or primary key for this column-list
          rp0428
          Welcome to the forum!
          >
          Hi,friends i created tables as above when i creating 'ORDERS' table the error will fir as "ORA-02270: no matching unique or primary key for this column-list".
          can any body solve this issue.
          >
          No - not in this forum. This forum is ONLY for sql developer questions like the title says.

          Mark this question ANSWERED and repost it in the SQL and PL/SQL forum
          PL/SQL

          When you repost provide your 4 digit Oracle version.
          >
          CONSTRAINT FK2_ORDERS FOREIGN KEY (ITEM_NUM) REFERENCES ITEM(ITEM_NUM));
          >
          You can't reference ITEM.ITEM_NUM because, as the exception says, there is 'no matching unique or primary key for this column'

          The primary key on the item table contains two columns.
          >
          CONSTRAINT PK_ITEM PRIMARY KEY(ITEM_NUM,TYPE));