postgresql Java JDBC 一次性传入多个参数到 in ( ?) - multple/list parameters
经常不清楚需要传入多少个参数到 IN () 里面,下面是简单方法:
方法 1 - in ( SELECT * FROM unnest(?)) )
Integer[] ids={1,2,3};
try {
PreparedStatement pst=conn.prepareStatement("select * from emp where id in (SELECT * FROM unnest(?))");
Array a = conn.createArrayOf("integer", ids);