List<Long> list = new ArrayList();
list.add(123458686L);
list.add(585858424L);
list.add(688584241L);
String empcomm = list.stream.map(String::valueOf).collect(Collectors.joining(","));
PreparedStatement pstmt= con.prepareStatement("select * from emp where empid=? and empidList in(?))");
pstmt.setLong(1,123458686L);
pstmt.setString(2,empcomm);
ResultSet rs = pstmt.executeQuery();
I am getting invalid number exception(ORA-01722) while executing above query.
Yeah that's not going to work, you're looking for setArray()
https://docs.oracle.com/javase/tutorial/jdbc/basics/array.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.