ORA-01795 in 问题的一个解决方法
2020-09-13 18:25:01
32次阅读
0个评论
ORA-01795: maximum number of expressions in a list is 1000

StringBuffer sb = new StringBuffer();

List<Long> columnContents = new ArrayList<Long>();

for ( int i = 0; i < columnContents.size(); i++) {

if ((i % 10) == 0 && i > 0) {

sb.deleteCharAt(sb.length() - 1);

sb.append( ") OR " + "ID" + " IN ( '" + columnContents.get(i) + "'," );

// resolved ORA-01795 problem.

} else {

sb.append( "'" + columnContents.get(i) + "',");

}

}

// delete the last comma
sb.deleteCharAt(sb.length() - 1);
String selectSQL = "SELECT * FROM T_CUST_FOLLOWUP_LIST WHERE ID IN ( " + sb.toString() + " )";
System. out.println(selectSQL);
收藏 0 0

登录 后评论。没有帐号? 注册 一个。

程序猿

  • 0 回答
  • 0 粉丝
  • 0 关注