Tuesday, May 2, 2017

How to implement Pagination in Oracle 11g:

Developer often require to limit the records feteched in their Java code between a lower limit and upper limit .

We can use the below method in Oracle 11g to get data between offset and limit:

 select c1.CASEID,c1.COMPANY_EMPLOYEE_COUNT,c1.COMPANY_LEGAL_NAME,c1.COMPANY_SERVICE_STATUS,c1.CUSTOMER_ACCOUNT_NUMBER,c1.HOLD_FLAG,C1.LINE_OF_BUSINESS,C1.PRINCIPAL_EMAIL
   from (Select cf.*,row_number() over (order by cf.CASEID ASC) row_num from CIGORA.CF_Company cf) c1 where row_num between :x and :x+10


 select c1.* from (Select cf.*,row_number() over (order by cf.CASEID ASC) row_num from CIGORA.CF_Company cf) c1 where row_num>:x and row_num<:x+10