If Multiple records retuns from lookup source record

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
prams
Participant
Posts: 73
Joined: Mon Apr 02, 2007 11:26 pm

If Multiple records retuns from lookup source record

Post by prams »

HI

I have a requirement like

i am getting records from source and next stage i doing lookup with different tables with different columns.

If lookup retuns multiple records i need to reject the source record.

so how to achieve this desin can any one tell me please.

Thanks in Advance

Prams
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Not sure if any DS stage can do such but quickest way that springs to mind is a pre-check identifying how many records meet the join criteria. Preferably only hold those that should be rejected and reject when found (assuming the number to be rejected is minimal compared to the total number of rows)
Pagadrai
Participant
Posts: 111
Joined: Fri Dec 31, 2004 1:16 am
Location: Chennai

Re: If Multiple records retuns from lookup source record

Post by Pagadrai »

prams wrote: If lookup retuns multiple records i need to reject the source record.
Hi,
If your lookup is a table, you can write the lookup query in this way:-
1) Group by the columns that you are going to use as lookup keys
2) obtain the count also along with the other required values
3) add a 'Having' clause where count = 1.

In you job, you can reject the records that dosent match the lookup.

NOTE: This scenario works unless you want to capture the two rejects seperately:-
Lookup records dosent exist and
Lookup has more than one record matching.
Post Reply