Four Stars

One To Many problem

Hi all

 

I have 1 row in oracle DB i need to insert to Postgres tables  1 Partner 1-1 Partner address (home/work address)

In Partner table have 1-1 foreign key  home_address/work_address 

 

Clipboard01.jpg

Get Addresses ids from sp ("select nextval('public.addr_seq') as workaddress_id"/"select nextval('public.addr_seq') as homeaddress_id") tpostgressinput(lakcim_id/levcim_id)

In the map i set this ids.

When i insert 2 Address and 1 Partner table show the next errormessage :

 

Clipboard02.jpg

 

Zoltan

  • Data Integration
3 REPLIES
Seven Stars

Re: One To Many problem

Split your job to two subjobs.

 

one to load CIM table and another one to load to partner table so that it will not violate the foreign key constraint.

Thanks,
Sid
Mark as solution if this resolved your issue
Four Stars

Re: One To Many problem

Thanks,

 

I create two job ? Sorry i missing something in my workflow, please help me.

 

Job1 

tOracleInput  -> tMap->tPostgresOutput(Addr1)

                                  ->tPostgresOutput(Addr2)

 

Job2  

  tOracleInput  -> tMap->tPostgresOutput(Partner

 

Job1-onSubJobOk>Job2 

my question is how to pass parameters??? (PartnerId for 1st tOracleinput, parameter Addr1-2 for Job2 Partner)

 

Thank you,

 

Zoltan

 

Seven Stars

Re: One To Many problem

use globalMap.get() and globalMap.put() functions.

For example I am calculating a value Partnerid in subjob1. then I should put in a global variable.

globalMap.put("partnered",row1.partnerid)

in second subjob you can call this variable using below function.
if the variable is string
(String) globalMap.get("partnered")

let me know if this helps

Thanks,
Sid
Mark as solution if this resolved your issue