Running a SQL statement using parameter
Posted: Wed Jun 21, 2006 4:20 am
Can I do the following(dynamic building of SQL query) in a server job :
I am using a DB2 UDB stage. In it output custom SQL I write :
#SQL_STATEMENT#
Then define the parameter SQL_STATEMENT as
Select count(*) as all from ABC.X_CONTACTS where XID = 'RVH'
Now when I run the job I get error like :
An unexpected token "<<missing table>>" was found following "SELECT all FROM ". Expected tokens may include: "<space>". SQLSTATE=42601
SQLExecDirect: Error executing statement 'SELECT all FROM <<missing table>>'. See following DB2 message for details.
I am using a DB2 UDB stage. In it output custom SQL I write :
#SQL_STATEMENT#
Then define the parameter SQL_STATEMENT as
Select count(*) as all from ABC.X_CONTACTS where XID = 'RVH'
Now when I run the job I get error like :
An unexpected token "<<missing table>>" was found following "SELECT all FROM ". Expected tokens may include: "<space>". SQLSTATE=42601
SQLExecDirect: Error executing statement 'SELECT all FROM <<missing table>>'. See following DB2 message for details.