如下面的例子: ?中是一个列表,如'1','2','3'. 替换后应该是 in ('1','2','3'),但是我把'1','2','3'传进取却不能正确的执行取得结果,跟踪发现参数被当初一个字符串了里面的引号被转义了,变成in (''1','2','3'') ,导致结果不对,请问像sql中 in (?),preparedStatement设置参数要怎么处理?
PreparedStatement statement = connection.prepareStatement("Select * from test where field in (?)");
Array array = statement.getConnection().createArrayOf("VARCHAR", new Object[]{"A1", "B2","C3"});
statement.setArray(1, array);
ResultSet rs = statement.executeQuery();
Just watched it again in java
preparedStatement
should be handled like this:
or:
in(?,?,?)
Then assign multiple timeshttp://fish198398.iteye.com/b...