Parameter

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
dsconultant
Participant
Posts: 10
Joined: Sat Dec 05, 2009 2:05 pm

Parameter

Post by dsconultant »

Hi,
My job uses query in a parameter.

Eg: select * from personnel is #query#

Now I want to put a condition.

select * from personnel where id in ('1','2')

I want to put ('1','2') in a parameter #condition#

so I want
select * from personnel where id in #condition# to be in #query#.
But when I put a parameter inside a parameter it doesnot read the second parameter #condition# and I get an error saying "missing expression".

How can I handle this?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't put a "parameter in a parameter", there's only one level of resolution for them.
-craig

"You can never have too many knives" -- Logan Nine Fingers
krisp321
Participant
Posts: 39
Joined: Thu Mar 04, 2010 12:39 am

Re: Parameter

Post by krisp321 »

Try this

select * from personnel where id in ('#condition1#','#condition2#')

when you want to put parameters in SQL, use the single quotes in SQL level but not in parameter

so in parameter level
condition1=1 (do not put quotes here)
condition2=2 (do not put quotes here)
dsconultant wrote:Hi,
My job uses query in a parameter.

Eg: select * from personnel is #query#

Now I want to put a condition.

select * from personnel where id in ('1','2')

I want to put ('1','2') in a parameter #condition#

so I want
select * from personnel where id in #condition# to be in #query#.
But when I put a parameter inside a parameter it doesnot read the second parameter #condition# and I get an error saying "missing expression".

How can I handle this?
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can do something like

myQuery = "SELECT yourColumns FROM yourTable"
myCondition = "WHERE yourConditionColumn = 'xyz'"

and in your query defn, provide your user defined query as
#myQuery#
#myCondition#
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Re: Parameter

Post by gssr »

dsconultant wrote:Hi,
My job uses query in a parameter.

Eg: select * from personnel is #query#

Now I want to put a condition.

select * from personnel where id in ('1','2')

I want to put ('1','2') in a parameter #condition#

so I want
select * from personnel where id in #condition# to be in #query#.
But when I put a parameter inside a parameter it doesnot read the second parameter #condition# and I get an error saying "missing expression".

How can I handle this?
Are you using the whole query in a Parameter, Can you tell what is your business requirement to have a query in PARAMETER?
RAJ
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You can do it all in one parameter but you cannot run the job using dsjob because you cannot quote it properly. You have to start the job with another job or in Director. It gets tricky.
Mamu Kim
abhijain
Participant
Posts: 88
Joined: Wed Jun 13, 2007 1:10 pm
Location: India

Post by abhijain »

Earlier I have suggested some workaround for such scenario.

Hope this will help for you.

viewtopic.php?t=131761&highlight=
Rgrds,
Abhi
Post Reply