How to code such a simple SQL with Spring JDBC ?
UPDATE tableA SET column1 = var1 WHERE column1 IN (var2, var3, ...);
where var1 is dynamic variable and var2, var3, ... - dynamic variable list.
How to code such a simple SQL with Spring JDBC ?
UPDATE tableA SET column1 = var1 WHERE column1 IN (var2, var3, ...);
where var1 is dynamic variable and var2, var3, ... - dynamic variable list.
Without the IN
, you can do like this:
PreparedStatement ps = connection.prepareStatement("UPDATE tableA SET column1 = ? WHERE column1 =? ");
ps.setString(1, var1);
ps.setString(2, var2);
And about how to deal with In
I hope this may give you some clue.
After some search, I also found this question may help you:
PreparedStatement with list of parameters in a IN clause