Adding Primary Key on Unique Index Ora-01418 or ORA-14196 (Doc ID 577253.1)

Last updated on MAY 07, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 9.2.0.1 to 12.2.0.1 [Release 9.2 to 12.2]
Information in this document applies to any platform.
Information in this document applies to any platform.

Goal

Customer wants to add a PK based only on two of three columns of an UNIQUE index, and this fails with:

ORA-1418 ORA-01418: specified index does not exist.  in 9.2 and 12c

ORA-14196: Specified index cannot be used to enforce the constraint. in 10.2

SQL> CREATE UNIQUE INDEX "ER"."PTY_TC_ID_COMP_AMT_IDX" ON "ER"."ER_PARTY_TRN_COMPONENTS" 
        ("PTY_TRN_UID", "TRANSACTION_COMPONENT", "COMPONENT_AMT")
  PCTFREE 10 INITRANS 11 MAXTRANS 255 COMPUTE STATISTICS
  STORAGE(INITIAL 131072 NEXT 131072 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" ; 

Index created.

SQL> alter table er.er_party_trn_components
     add constraint pty_tc_pk
     primary key (pty_trn_uid, transaction_component)
     using index er.pty_tc_id_comp_amt_idx
     enable novalidate
     /

ERROR at line 1:
ORA-14196: Specified index cannot be used to enforce the constraint.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms