To know which FK this is
select * from DBA_CONSTRAINTS where constraint_name = 'SYS_C007381';
Get the r_constraint_name from above to find the parent table:
select * from DBA_CONSTRAINTS where constraint_name =
'<r_constraint_name>';
To find the column/s in the parent table that the FK references:
SELECT * FROM DBA_CONS_COLUMNS WHERE constraint_name =
'<r_constraint_name>';
Deepthi Samarasinghe
Database Architect
-----Original Message-----
From: nico
[mailto:oracledba-ezmlmshield-x1673002.[Email address protected]
Sent: Wednesday, November 29, 2006 3:31 PM
To: LazyDBA Discussion
Subject: Re: RE: ORA-02291: integrity constraint violated - parent key
not found
Hi,
You should always give names to your foreign key constraints, so in the
error message this name will be used, now a system generated name is
used. So will recognize which constraint is violated.
Nico Swart
----- Oorspronkelijk bericht -----
Van: Chris Koenig <oracledba-ezmlmshield- x33570771.[Email address
protected]
Datum: woensdag, november 29, 2006 8:47 pm
Onderwerp: RE: ORA-02291: integrity constraint violated - parent key not
found
> It looks like some other table has the field CBSS.DMEPOS_BIDDER set as
> a foreign key. You need to insert the parent record into that table
> first.
>
> -----Original Message-----
> From: Susan Yang
> [mailto:oracledba-ezmlmshield-x89310402.[Email address protected]
> Sent: Wednesday, November 29, 2006 11:43 AM
> To: LazyDBA Discussion
> Subject: ORA-02291: integrity constraint violated - parent key not
> found Hi All,
>
> I created 4 tables and these 4 tables have primary key and foreign key
> relationship.
>
> SQL> desc DMEPOS_BIDDER
> Name Null? Type
> ----------------------------------------- --------
> ------------------------
> BIDDER_NUM NOT NULL CHAR(7)
> BIDDER_ENT_NAME VARCHAR2(20)
> LAST_CHG_USER_ID VARCHAR2(30)
> LAST_CHG_DT DATE
> ENT_TYPE_CD CHAR(2)
> SPCLTY_PRVDR_IND CHAR(1)
> SNF_PRVDR_IND CHAR(1)
> PHYSN_PRVDR_IND CHAR(1)
> SUPLR_ID NUMBER(38)
> NTWRK_ID NUMBER(38)
>
> SQL> desc DMEPOS_SUPPLIER
> Name Null? Type
> ----------------------------------------- --------
> ------------------------
> SUPLR_ID NOT NULL NUMBER(38)
> LGL_BUSNS_NAME VARCHAR2(35)
> MLG_LINE1_ADR VARCHAR2(35)
> MLG_LINE2_ADR VARCHAR2(35)
> MLG_CITY_ADR VARCHAR2(35)
> MLG_STATE_CD CHAR(2)
> MLG_ZIP_CD CHAR(5)
> MLG_ZIP_EXTNSN_CD CHAR(4)
> BUSNS_PHNE_NUM CHAR(10)
> SUPLR_EMAIL_ADR_TXT VARCHAR2(80)
> BUSNS_FAX_PHNE_NUM CHAR(10)
> LAST_CHG_USER_ID VARCHAR2(30)
> LAST_CHG_DT DATE
> NSC_NUM CHAR(10)
>
> SQL> desc network
> Name Null? Type
> ----------------------------------------- --------
> ------------------------
> NTWRK_ID NOT NULL NUMBER(38)
> LAST_CHG_USER_ID VARCHAR2(30)
> LAST_CHG_DT DATE
>
> SQL> desc entity_type
> Name Null? Type
> ----------------------------------------- --------
> ------------------------
> ENT_TYPE_CD NOT NULL CHAR(2)
> ENT_TYPE_DESC VARCHAR2(20)
> LAST_CHG_USER_ID VARCHAR2(30)
> LAST_CHG_DT DATE
>
> The table DMEPOS_BIDDER has primary key (BIDDER_NUM) and 3 foreign
> keys (ENT_TYPE_CD, SUPLR_ID, and NTWRK_ID)
>
>
> When populating data into the table DMEPOS_Bidder, I got the following
> error:
>
> Record 1: Rejected - Error on table CBSS.DMEPOS_BIDDER.
> ORA-02291: integrity constraint (CBSS.SYS_C007381) violated - parent
> key not found...
>
> Can anyone advise why this happens?
>
> Thanks!
> syang
>
>
>
>
>
> -------------------------------------------------------------------
> --
> TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post
> a dba job: http://jobs.lazydba.com To Subscribe :
> http://www.LazyDBA.com To unsubscribe:
> http://www.lazydba.com/unsubscribe.html
>
>
>
>
>
>
>
> -------------------------------------------------------------------
> --
> TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post
> a dba job: http://jobs.lazydba.com To Subscribe :
> http://www.LazyDBA.com To unsubscribe:
> http://www.lazydba.com/unsubscribe.html
>
>
>
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
Oracle LazyDBA home page