I want to be able to define the WHERE clause of a JDBC adapter service (SELECT template) at runtime. Take the following SQL statement:
SELECT * FROM myTable WHERE myField = ?
I want to map a value on the pipeline to “?”. Is this possible? So far, all I can figure out how to do is hardcode a value for “?” when configuring the adapter service.
Yes, of course you can. The only thing you need to do is to create a line in the bottom table.
In the up table, you defined that you wanted a condition on myField to be = to ?.
In the bottom table, you have add a line to define that you want this first ? to be the myParam parameter which is for example a String (java) and Varchar (sql)
Then your adapter will have a new input parameter called myParam
select * from myTable where myField = ?
In the pipeline, if there is a corresponding field for myField, all you have to do is, in the $dbParamNames field, put the name of the variable to be substituted.
select * from myTable where myField = %myField% and select the perform variable substitution checkbox.
How to pass null value in the where clause.
I want to retrieve records having a column with null.
Please ignore this post. The issue was different one.