Error using the User variables parameters in the job

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
chandu123
Premium Member
Premium Member
Posts: 40
Joined: Mon Sep 12, 2016 1:26 pm

Error using the User variables parameters in the job

Post by chandu123 »

My sequence has User variables activity followed by a Job Activity. I have set the job parameter of the Job activity using User variable set in the previous step.

Var1 = UserVariables_Activity_1.Var1

I am using this variable in the source sql of the job as below:

Select #Var1# as Variable1 from dual;

I am getting below error when I run the job.

Oracle_Connector_3,0: The following SQL statement failed: Select as Variable1 from Dual.
Oracle_Connector_3,0: The OCI function OCIStmtExecute returned status -1. Error code: 936, Error message: ORA-00936: missing expression. (CC_OraStatement::executeSelect, file CC_OraStatement.cpp, line 3,900)

Where am I doing wrong?
HB
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your SQL expression is missing a column name. Select WHAT as Variable1 from Dual?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chandu123
Premium Member
Premium Member
Posts: 40
Joined: Mon Sep 12, 2016 1:26 pm

Post by chandu123 »

My SQL is "Select #Var1# as Variable1 from dual;" where Var1 is the job parameter (derived from User variable activity). Can't we use job parameter in select SQL?
HB
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

To start with, print the values in the log and see how the query looks like after the variable has been passed?

May be space issue, or missing values .......

Once you are happy then use it in the job.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In other words, you can use job parameters in select SQL. Since it is resolving as empty, you must have passed in a null value... that or not really passed it to the Job Activity stage correctly.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The SQL statement that the Oracle Connector reported as execution was Select as Variable1 from Dual.

This implies that the value of job parameter Var1 had not been set (or had not been properly set).

Note that #Var1# is NOT a reference to a variable from a User Variables activity. You cannot use a User Variables variable reference in an SQL statement; however you could build the entire SQL statement in a User Variables 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.
Post Reply