Page 1 of 1

Using environment varaible in the job paramter

Posted: Wed May 21, 2008 3:08 am
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,

Posted: Wed May 21, 2008 6:41 am
by jreddy
Try this

#FromClause# = prdtbl where $LoadType =1

Posted: Wed May 21, 2008 6:58 am
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.

Posted: Thu May 22, 2008 3:46 am
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,

Posted: Thu May 22, 2008 3:48 am
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,

Re: Using environment varaible in the job paramter

Posted: Thu May 22, 2008 5:24 am
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.

Posted: Thu May 22, 2008 6:28 am
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.