Ask Your Question
1

Custom IN sql query in JDBC lookup

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

divyang gravatar image

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

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
3

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

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

Comments

1

worked !! Thanks for helping

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

Question Tools

1 follower

Stats

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

Seen: 316 times

Last updated: Mar 21