Here I found the answer,
I was using ojdbc7 driver and resultset has a limitation of fetching records count of Integer.MAX_VALUE i.e. 2147483647
After updating ojdbc7 to ojdbc8, the issue got resolved and it successfully fetched the rest of the records.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…