Ask Your Question

Custom IN sql query in JDBC lookup

asked 2019-03-13 13:24:31 -0600

divyang gravatar image

updated 2019-03-21 10:01:20 -0600

metadaddy gravatar image

I want to use custom sql IN query in the jdbc lookup stage.

concatedList = List of String for example , ["1","2","3"]

query - SELECT * FROM tableName WHERE id IN (${record:value('/concatedList')});

But this is getting converted as :

SELECT * FROM tableName WHERE id IN (Field[STRING:1], Field[STRING:2], Field[STRING:3])

Expected :

SELECT * FROM tableName WHERE id IN ("1","2","3");

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-14 10:33:43 -0600

jeff gravatar image

Can you try using expression evaluator, before the JDBC lookup, to create a new field that will have the properly formatted portion of the query? Basically, something like the following

${str:concat(str:concat('"', list:join(record:value('/concatedList'), '","')), '"')}

Then, whatever field you have set to this expression, refer to that from your lookup stage.

edit flag offensive delete link more



worked !! Thanks for helping

divyang gravatar imagedivyang ( 2019-03-21 04:03:33 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-03-13 13:20:10 -0600

Seen: 571 times

Last updated: Mar 21 '19