Integrity constraint

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Integrity constraint

Post by vardhan354 »

Hi,

i am getting the following error, the records are not loaded into the target, and giving warning messages.

ORA-02291: integrity constraint (schema name.CONTACT_PERS_FK) violated - parent key not found
DBMS.CODE=ORA-02291

Please help me.

Thanks in advance.
ETL
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

It's complaining about ForeignKey violation. Check your constraints on the table you are trying to load. The key you are trying to load into the table doesn't exist(and is supposed to exist) in the parent table.
Kris

Where's the "Any" key?-Homer Simpson
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Post by thumsup9 »

You will find more on this in the forum. Your Parent table is missing some key vlaues and you may have to investigate why they are missing in there.

viewtopic.php?t=93704&highlight=parent+key+not+found
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Post by vardhan354 »

i loaded the parent job first, Again i am getting the same error,
can i use lookup with that table with this job and load the data,

which option is better:-

drop the constraint (or) using lookup with the table.

on the same column.

Please help me.

Thanks,
ETL
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

vardhan354 wrote: i loaded the parent job first, Again i am getting the same error,
It either means that you are doing something wrong in the job or the data in the table is incorrect.
vardhan354 wrote: can i use lookup with that table with this job and load the data,
which option is better:-
drop the constraint (or) using lookup with the table.
on the same column.
Can you explain this in detail?
Kris

Where's the "Any" key?-Homer Simpson
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well the RI doesnt just restrict itself to parent child relationship. You could be loading a code value into the table and that code value must be missing in the code table. See if thats the case.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Post by vardhan354 »

I mean supose there are two tables.

table A, table B

table A --- parent table

i already loaded the data into tableA.

now when i am trying to load the data into tableB, it is giving integrity constraint error.

My opinion if lookup with parent table (table A) and table B on column which we are getting integrity constraint (key violation).

is this work.
ETL
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Post by vardhan354 »

Hi DSGURU,

please explain clearly how to check the codevalue and what is the code value.

Thanks
ETL
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well, with the lack of info about your business, i cannot tell you that, thats for you to investigate. Code columns usually end with _CD. See if you have any such column that you are loading.
I am not saying that this is the problem, it might be. Chances are more of you missing a record load in the parent table and loading it in the child table.
Have a reject link coming out of your transformer with the constraint as
LoadLink.REJECTED where LoadLink is the name of the link thats going into your database. This way you will capture all such records which are rejected. Investigate those values in the parent table and see why are they not getting loaded in the parent table.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
vardhan354
Participant
Posts: 76
Joined: Wed Jan 25, 2006 6:42 pm

Post by vardhan354 »

I am using the reject link,

but i am getting the rejected rows, beside the rejected rows i am getting the warnings with row information, warning of integrity constraint.
ETL
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Yes, when a row will be rejected, you will get warning messages. Now you have to look into those rejected rows and investigate why the FK column value is not present in the parent table. This will give you a good starting point for your investigations.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply