Error: 3977: The Parent Key is not unique or not valid

Database
Enthusiast

Error: 3977: The Parent Key is not unique or not valid

Hi ,

Need help.....

I am getting the following error when creating a table.

3977: The Parent Key is not unique or not valid

Thanks in advance..

Nick
2 REPLIES
Junior Contributor

Re: Error: 3977: The Parent Key is not unique or not valid

Could you please elaborate after RTFM?

3977 The Parent Key is not unique or not valid.
Explanation: The referenced column(s) (Parent Key)
specified in the referential constraint must either be a
valid unique primary index (UPI) or a valid unique secondary
index (USI) of the referenced table. Note that an
UPI/USI could exist but in an invalid state and in which
case this error will also be returned.

Dieter
Enthusiast

Re: Error: 3977: The Parent Key is not unique or not valid

Can we create 2 Foreign Keys on same column referring to 2 different tables

CREATE SET TABLE TEST ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
DATABLOCKSIZE = 130560 BYTES, CHECKSUM = DEFAULT
(
Sale_Date DATE FORMAT 'YYYY-MM-DD' NOT NULL,
Item_Id INTEGER NOT NULL,
Store_Party_Id INTEGER NOT NULL,
SAP_CUSTOMER_ID INTEGER,
FOREIGN KEY ( SAP_CUSTOMER_ID ) REFERENCES WITH NO CHECK OPTION DIM_CUSTOMER ( Customer_Party_Id ),
FOREIGN KEY ( SAP_CUSTOMER_ID ) REFERENCES WITH NO CHECK OPTION dev_dw_mstr_dbase.DIM_CUSTOMER_SALES ( Customer_Party_Id ))
UNIQUE PRIMARY INDEX TEST ( Sale_Date ,Item_Id ,Store_Party_Id, )

Thanks alot

Nick