Need to pass range of values to prepared statement
<p>I need to pass range of values to prepared statement.</p>

<p>For eg.</p>

<p>505 is total count</p>

<p>need to divide it by 100</p>

<p>so the ranges will be like 1 to 100 ,101 to 200...501 to 505.</p>

<p>I have a code to implement this. But that is complex way of doing this.
Here I've attached the code. Is there any other easy way to do this?</p>

<pre><code>upperValue = maxRowSize;
quotient = rowCount / maxRowSize;
rem = rowCount % maxRowSize;
if (rem == 0) {
    loopcount = quotient;
    finalValue = 0;
} else {
    loopcount = quotient + 1;
    finalValue = rem;
}
lowerValue = 1;

for (int i = 0; i &lt; loopcount; i++) {
    if (finalValue != 0 &amp;&amp; i == loopcount - 1) {
        upperValue = (lowerValue - 1) + finalValue;
    }
    resultSet = executeQuery(connection, query, lowerValue, upperValue);
</code></pre>
