Reference lookup generated, Only the last row was used

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shilpa79
Participant
Posts: 131
Joined: Thu Jan 20, 2005 5:59 pm
Location: Virginia

Reference lookup generated, Only the last row was used

Post by shilpa79 »

IndividualDim_S..X_individual: Reference lookup generated 3 rows. Only the last row was used.
When data exceeds above the recordcount then I am getting this warning.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

You need to change your lookup logic so that only a single row is returned

Or are you trying to return multiple row for lookup ?

Give your job design, what you are trying to do, more details.... if the above does not help you.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
shilpa79
Participant
Posts: 131
Joined: Thu Jan 20, 2005 5:59 pm
Location: Virginia

Post by shilpa79 »

I am applying type II for this Job design:
When I am loading initially it will run successfully without any warnings.
when I run with the diff month of data with update and inserts i am getting the above error.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What stage are you using to do the reference lookup? As noted, when your query in the stage returns more than one record, only one will be returned. Some stages do this silently, some do it and log a warning as well. The solution is to rewrite the query so that it returns the singleton row you want out of the rows it selects.

Unless you need to return multiple rows, for that you'd have to use either the ODBC or UV stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Since you have mentioned that you are applying type2 for this job, I some how have a feeling that you are not selecting your keys correctly. I might be wrong too. Also, what stage are you using for lookups?
Kris

Where's the "Any" key?-Homer Simpson
shilpa79
Participant
Posts: 131
Joined: Thu Jan 20, 2005 5:59 pm
Location: Virginia

Post by shilpa79 »

I am using DB2 udb stage as lookup stage and inputstage
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok... what about everything else? As noted, it can only return a single row when used as a lookup so you'll need to correct your query in order to make the message that brought you here go away.
-craig

"You can never have too many knives" -- Logan Nine Fingers
neeraj
Participant
Posts: 107
Joined: Tue May 24, 2005 4:09 am

Post by neeraj »

Shilpa,

What I assume your table have some duplicates.. The result when writing to hasfile. It takes the last record and update.

So remove the duplicates from the table.

Regards
Neeraj
tagnihotri
Participant
Posts: 83
Joined: Sat Oct 28, 2006 6:25 am

Post by tagnihotri »

Agree with Craig, multiple rows returned never sounds good.
chulett wrote:Ok... what about everything else? As noted, it can only return a single row when used as a lookup so you'll need to correct your query in order to make the message that brought you here go away.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Sounds like you are populating your reference data set (from the dimension table) with both current and non-current rows. Check that you only load current rows.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
shilpa79
Participant
Posts: 131
Joined: Thu Jan 20, 2005 5:59 pm
Location: Virginia

Post by shilpa79 »

The bussiness want to maintain the multiple records(Realtime) for each employee working on different locations and SSN in the lookup and insert a single active record in the target table.
So that when the same employee come in with the same SSN and same ID and diff location it will do the updates and inserts.
tagnihotri
Participant
Posts: 83
Joined: Sat Oct 28, 2006 6:25 am

Post by tagnihotri »

As highlighted "insert a single active record in the target table", we should have only one active record which if changed should be updated or if a new record not present in db comes, should be inserted.

Therefore in no scenario the count of records returned from the lookup should be more than one, if you are extracting only active records!
Post Reply