no matching key from 2 tables

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

no matching key from 2 tables

Post by srini.dw »

Hi,

I have 2 tables Table ABC and Table DEF

Table ABC
FACTOR_NBR,FACTOR_NM
.50----> SQI
.00----> BAG
.00----> COMP
.50----> PROFIT


Table DEF
PROFIT_INDX
SRVC_QLTY_INDX
COMP_INDX
BAG_INDX
SRVC_RECOMND_INDX ------------ > To Update


Based on the values of Table ABC, I need to do the calculations (below statement) and update column(SRVC_RECOMND_INDX) in Table DEF.
But there's no matching key.

update DEF b
set
SRVC_RECOMND_INDX = (select SRI from (
select unique_id,
CASE when (PROFIT_INDX is null and SRVC_QLTY_INDX is null
and BAG_INDX is null and COMP_INDX is null)
then NULL
else (NVL(PROFIT_INDX,0) * ${profitWeight} + NVL(SRVC_QLTY_INDX,0) * ${sqiWeight} +
NVL(BAG_INDX, 0) * ${bagWeight} + NVL(COMP_INDX,0) * ${compWeight})
END SRI
from DEF ) a
where a.unique_id = b.unique_id);


where
profitWeight
sqiWeight
bagWeight
compWeight
are the values from Table ABC. (select trim(FACTOR_NBR) from ABC where FACTOR_NM ='${weightName}';), Storing values elsewhere.

I need to do the same logic in Data stage, not able to get any ideas, Any ideas would be appreciated.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's no matching key, therefore there's no matching key. Whether you're using DataStage or not, this is your fundamental problem. One approach is to form the Cartesian product, but this is almost certainly not the correct answer. You need to harrass your data providers to give you some means of linking the two sets of data. If not, their data model is sadly incomplete.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply