How to resolve ORA-02268 Error Message in Oracle database

Learn the reason and how to get to the bottom of the ORA-02268 error message in Oracle.

Description

When you come upon an ORA-02268 error, the following error message will appear:

ORA-02268: referenced desk does no longer have a major key

Cause

You tried to reference a table using a unique or predominant key.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

This error usually occurs when you strive to create a overseas key that references a table that does not have a predominant key. To unravel this problem, create a major key on the referenced table. Then re-execute your command to create the overseas key.

For example, if you had tried to execute the following commands.

CREATE TABLE supplier
( supplier_id numeric(10) not null,
  supplier_name varchar2(50) not null,
  contact_name varchar2(50)
);

CREATE TABLE products
( product_id numeric(10) not null,
  supplier_id numeric(10) not null,
  CONSTRAINT fk_supplier
    FOREIGN KEY (supplier_id)
    REFERENCES supplier
);

You would receive the following error message:

Since there is no predominant key on the supplier table, you can not create a overseas key on the products desk that references the dealer table.

You can right this error by including a predominant key to the dealer table as follows and then re-execute the CREATE TABLE statement for the merchandise table:

ALTER TABLE supplier
 ADD CONSTRAINT supplier_pk PRIMARY KEY (supplier_id);