JDBC adapter Conundrum

I need to write a JDBC adapter service for the which could cater to the following queries

“select * from table_a where id in(a,b,c,d,e,f,g,h,i,j)”
“select * from table_a where id in(a,b)”
“select * from table_a where id in(a,b,c,d)”

One way of doing it is to write a custom SQL which would look
"select * from table_a where id in (?,?,?..).

However the problem i have is that in some cases the above custom sql could have only 2 values or in some cases it could have 50.,Is there a way that i can write a generic jdbc adapter service to handle this ?

You could use dynamic SQL to do the substitution at runtime. Look at the section entitled ‘Configuring a Dynamic SQL Statement’ in the JDBC Adapter User Guide available on the webMethods Advantage website.