Update on 2 database

Update on 2 database

 

  

I've 2 datasources defined through federated concept. Iam able to
update/insert the data of the database "UATDB".
But when I try to update a row of "TESTDB" database, I am getting the
following error.

I also tried like assigning the i.xx column to a temp variable. But
still the problem is not solved.
I also configued "Multi Site Update" and it was a suceesfull one. I
understand through development guides that when you need to
insert/update 2 different datasources, then two-phase commit needs to be
configured.
Can you advise me on how about doing the same???
***********

CREATE PROCEDURE test_proc
dynamic result sets 1
language sql
MODIFIES SQL DATA

BEGIN

declare i integer default 1;
declare rcpt_no varchar(20);
declare loc_code int;

for i as select location_code,receipt_number,transaction_date,
account_number,days_delay,account_override,amt_due,
amt_paying,cash_tendered,cash_paying,req_for_cancel,
cancel_date,cancel_reason,remarks,auth_remarks,receipt_status,
cancel_datetime,auth_datetime
from rrs_off_smet_hdrvw ur

do

insert into
smetro_hdr_test(location_code,receipt_number,transaction_date,
account_number,days_delay,account_override,amt_due,
amt_paying,cash_tendered,cash_paying,req_for_cancel,
cancel_date,cancel_reason,remarks,auth_remarks,receipt_status,
cancel_datetime,auth_datetime
)
values ( i.location_code,
i.receipt_number,
i.transaction_date,
i.account_number,
i.days_delay,
i.account_override,
i.amt_due,
i.amt_paying,
i.cash_tendered,
i.cash_paying,
i.req_for_cancel,
i.cancel_date,
i.cancel_reason,
i.remarks,
i.auth_remarks,
i.receipt_status ,
i.cancel_datetime,
i.auth_datetime) ;

set rcpt_no = i.receipt_number;
set loc_code = i.location_code;

commit;

update rrs_off_smet_hdrvw
set migrated_status = CAST('Y' AS VARCHAR(5))
where receipt_number = rcpt_no
and location_code = loc_code;

end for ;


Regards
Iswariya Vasan


DB2 & UDB email list listserv db2-l LazyDBA home page