Hi I'm using DB2 V8.1.1.61 FixPack 6 ESE on AIX 5.2
I having the following query
Code:
select
wp.wwpartnumber,
cp.country,
cp.partnumber,
ft.featurecode,
ft.fctype,
cppr.pubfromdate,
cppr.pubtodate,
ftdesc.fcmktgname,
ft.fccat,
ft.rectype,
ft.featid,
cppr.audience,
cppr.parentid,
cppr.childid,
cppr.country,
ft.process_asload_VV,
cppr.process_asload_VV
from
INT.wwproduct wp,
INT.cntryprodprodrel cppr,
INT.cntryproduct cp,
INT.feature ft,
INT.country ct,
INT.featuredesc ftdesc
WHERE
wp.wwprodid = cp.wwprodid
AND fctype = 'Primary FC'
AND cppr.parentid = cp.prodid
AND ft.featid = cppr.childid
AND ft.featid = ftdesc.featid
AND cp.country = ct.alpha2
AND ct.lang = substr(ftdesc.language,1,2)
AND (ft.PROCESS_ASLOAD_VV <> 'P' OR ftdesc.PROCESS_ASLOAD_VV <> 'P' OR cppr.PROCESS_ASLOAD_VV <> 'P')
I'd like to update the three talbes INT.feature ft,INT.featuredesc ftdesc,INT.cntryprodprodrel cppr, field PROCESS_ASLOAD_VV, but need that only for rows that were selected. I mean something like
Code:
UPDATE
INT.feature ft,INT.featuredesc ftdesc,INT.cntryprodprodrel cppr
SET
PROCESS_ASLOAD_VV = 'P',
UPDATED = CURRENT TIMESTAMP
WHERE EXISTS
(select *
from
INT.wwproduct wp,
INT.cntryproduct cp,
INT.country ct
WHERE
wp.wwprodid = cp.wwprodid
AND fctype = 'Primary FC'
AND cppr.parentid = cp.prodid
AND ft.featid = cppr.childid
AND ft.featid = ftdesc.featid
AND cp.country = ct.alpha2
AND ct.lang = substr(ftdesc.language,1,2)
AND (ft.PROCESS_ASLOAD_VV <> 'P' OR ftdesc.PROCESS_ASLOAD_VV <>
OR cppr.PROCESS_ASLOAD_VV <> 'P') )
As you see I need to update the three tables at a time but this is imposible in DB2
AFAIK. Am I wrong in that? the thing is that if I split into three different updates when I first update for example INT.FEATURE may leave some records out to update INT.FEATUREDES and INT.CNTRYPRODPRODREL.
How can this be done? is it posible to update multiple rows as in the query above? I read about it being possible in SQL Server and MySQL but nothing in DB2.
How about splitting the query into three updates and using transactions? when I commit it won't it happen the same as I stated above?
I read there is another post like this one but really didn't get a clue

Thanks for your time...
Luciano