Using environment varaible in the job paramter

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
avneeshrai
Participant
Posts: 12
Joined: Wed Jan 02, 2008 11:45 pm
Location: Hyderabad

Using environment varaible in the job paramter

Post by avneeshrai »

Using DRS stage to read from oracle database table, in the sql the from clause is a job paramter. In the job paramter I have a environment varaible, and the job aborts saying invalid character, can we use a environment varaible in the job parameter?


Here is the Job Paramter
#FromClause# = prdtbl where #$LoadType# =1

Here is how the SQL looks when we use SQL generated option

SELECT ABC FROM #FromClause#

The error is

DB: [DataDirect][ODBC Oracle Wire Protocol driver][Oracle]ORA-00911: invalid character
: SQLExecDirect: Error executing statement

'SELECT ABC FROM prdtbl where #$LoadType# =1'


Is it because the entire sql is in between ' ' and it is being considered as a string, if so is there a workaround for this?


Thanks,
jreddy
Premium Member
Premium Member
Posts: 202
Joined: Tue Feb 03, 2004 5:09 pm

Post by jreddy »

Try this

#FromClause# = prdtbl where $LoadType =1
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your 'invalid character' is the #, which means your parameter is not being recognized and evaluated. This is because a parameter cannot resolve another parameter inline.
-craig

"You can never have too many knives" -- Logan Nine Fingers
avneeshrai
Participant
Posts: 12
Joined: Wed Jan 02, 2008 11:45 pm
Location: Hyderabad

Post by avneeshrai »

Hi Craig,

So is there a work around for this issue, I did try just $ParamName and it too returns error, as expected.

Thanks,
avneeshrai
Participant
Posts: 12
Joined: Wed Jan 02, 2008 11:45 pm
Location: Hyderabad

Post by avneeshrai »

Hi Craig,

So is there a work around for this issue, I did try just $ParamName and it too returns error, as expected.

Thanks,
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Re: Using environment varaible in the job paramter

Post by ameyvaidya »

avneeshrai wrote:
Here is the Job Paramter
#FromClause# = prdtbl where #$LoadType# =1

Here is how the SQL looks when we use SQL generated option

SELECT ABC FROM #FromClause#
Assuming you call the job from a sequence, add a uservariable activity before the job activity stage and create one uservariable "FromClause". Resolve the from clause in this uservariable and then pass it to your job.
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

avneeshrai wrote:So is there a work around for this issue, I did try just $ParamName and it too returns error, as expected.
Can you please explain exactly how you tried this and what error you are now getting? I hate to assume too much here.
-craig

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