I have the input as customer number (CSR_ID BigDecimal(11,0)). The below code fails as Oracle query expression has the limitation of 1000:
//Start of the code
String cust_ids = null;
int cnt_cust = 0;
java.util.StringJoiner joiner = new java.util.StringJoiner(","," ( "," ) ");
//This is a loop which gets CSR_ID as input:
joiner.add(row5.CSR_ID.toString());
cnt_cust++;
//End of the code
System.out.println(joiner); // (1,2,3,...,100045)
cust_ids = joiner.toString();
Query looks like:
"select col1, col2 from customers where cust_id in " +
"(1,2,3,...,100045)";
I wanted to split this like below:
"select col1, col2 from customers where" +
" cust_id in (1,2,3...,1000)" +
" or cust_id in (1001,.....2000)" +
..... ;
How do I build this query expression in bulk of 1000 customer-id. Note: customer-id is not be sequential, an random values.