TeraData API Lookup based on a flat file

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
samit_9999
Participant
Posts: 20
Joined: Thu Oct 06, 2005 12:23 pm

TeraData API Lookup based on a flat file

Post by samit_9999 »

Hi,

I have a flat file with EmpNo and DeptNo. I am doing a lookup on teradata API based on EmpNo and try to get salary. The API has the following sql

Select EmpNo
Salary
from Employee
where EmpNo = :EmpNo

The lookup however fails with a message Cannot use value (or macro parameter) to match EmpNo

What could be the problem ?
Cant we do Teradata lookup as we OCI Lookups?

Thanks much in advance.

Sam
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Did the stage generate that SQL or did you? I would think your parameter marker would look more like :1 or ? rather than being bound using a column name. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

BTW how are you passing the employee nr to the sql?? if you ask me i would be using a job parameter and it will work fine.
samit_9999
Participant
Posts: 20
Joined: Thu Oct 06, 2005 12:23 pm

Hi

Post by samit_9999 »

Its a user defined sql.

To explain once again..

The flat file suppose gets an employee no 20. I then lookup to teradata running the following query, and try to get the Salary back.

Select EmpNo ,
Salary
from Employee
where EmpNo = :EmpNo

I also tried substituting :1 but it didnt work.

Sam
mcolen
Premium Member
Premium Member
Posts: 31
Joined: Wed Aug 11, 2004 8:59 am
Location: Florida

problem??

Post by mcolen »

If you pass the value to a teradata api filling in on stage tab teradata director(server) UserId and password for logging in to teradata. give it the table name and user defined sql to select the record using (passed field(field type) and a select from where field = :(using field name) it should be ok
samit_9999
Participant
Posts: 20
Joined: Thu Oct 06, 2005 12:23 pm

Post by samit_9999 »

Hi mcolen,

I am doing exactly the same.

Please refer my sql above...

I have passed all the other parameters as required like to userid id , password , server etc....
I have also mentioned that i am using user defined sql option.

Sam
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Have you used User Defined SQL to do lookups with the Teradata stage before this? If not or you're not completely sure what the sql should look like - let the stage generate it for you first. Get it close and see what the generated sql looks like. Switch it User Defined and tweak from there. Then there won't be any questions around what it needs to look like or the nuances of the bindings.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply