Passing Query Output as parameter

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Passing Query Output as parameter

Post by abhilashnair »

How can I pass output of a SQL query as parameter in a job
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

In a Server-Job You can use a Server-Routine to overwrite the UserStatus-variable. The resulting string can be used for succeeding jobs within a sequence. If the query returns several columns You have to format these as a single delimited string.

There is no direct way to pass the result of an SQL-query to a job as a parameter.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
soumya5891
Participant
Posts: 152
Joined: Mon Mar 07, 2011 6:16 am

Post by soumya5891 »

prepare a shell script with that query.Put the output of the sql into an variable.And then echo it.Now using a user activity stage in sequence job you can retrieve the result.Now you can pass that as a parameter.Hope this will work.
Soumya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is this a query that is guaranteed to return precisely one row? If so, what you seek can be done by using a server job to execute the SQL statement and load its output into the job's user status area whence it can be retrieved downstream in the controlling sequence via the Job activity's $UserStatus activity variable.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Passing Query Output as parameter

Post by chulett »

abhilashnair wrote:How can I pass output of a SQL query as parameter in a job
It would help if you clarified what exactly it is that you are asking. This SQL output and 'parameter' - are you speaking of the same job that is running the sql? Or another, downstream job?
-craig

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