In some cases you need to write something like this:

SELECT my_column FROM my_table where search_column IN (?)

Unfortunately this feature is not supported by JDBC, hence we have workarounds like these: Preparedstatement IN clause alternatives/StackOverflow

IN Clause Workaround

The workaround is pretty simple, if you want to execute this:

Then you join this list with single quotes and commas:

You can use this approach with relatively small lists, as the bigger the list, the longer the generated query. Every database has a limit on size of a query, so your mileage may vary.

Please, see references to methods Util#join and Collections#list . These classes are already on a classpath of every ActiveJDBC application.

How to comment

The comment section below is to discuss documentation on this page.

If you have an issue, or discover bug, please follow instructions on the Support page