Using SQL queries in job parameters

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
RAJARP
Participant
Posts: 147
Joined: Thu Dec 06, 2007 6:46 am
Location: Chennai

Using SQL queries in job parameters

Post by RAJARP »

Can I use SQL queries as values of job parameters directly?? If not, how can i use SQL queries to fetch the values of records in the database.

Can you plz tel me how to use procedures/routines to do the same. I actually want to fetch the max(id) from one table and use it as the value to populate the remaining records into another table.

Thanks
phanipriya
Participant
Posts: 12
Joined: Thu Feb 15, 2007 3:58 pm

Post by phanipriya »

Hi

SQL Queries can be passed as values to the job parameters directly and even the other job parameters can be passed as values to the conditions in the query using #<job-parameter name>#
phani
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You usuaully need to land the value into a sequential file then read that value in job control or a routine to feed it into a parameter.

Job Sequence

JobA Select Max(id) from whatever => SeqFileA
|
V
RoutineA Read Value set Arg1 = SeqFileA.value
|
V
JobB (Set parameter = RoutineA.Arg1
Mamu Kim
stefanfrost1
Premium Member
Premium Member
Posts: 99
Joined: Mon Sep 03, 2007 7:49 am
Location: Stockholm, Sweden

Post by stefanfrost1 »

Also, depending on the database engine your using you may need to slash (\) any special character. For instance:

Select col1 from table1 where datecol = '2007-12-12'

May need to be converted into

Select col1 from table1 where datecol = \'2007-12-12\'
-------------------------------------
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
Post Reply