I have to fetch only 50 records at a time from database (DB2), for this I have been using Row_Number but now the persons are telling that this Row_Number is not stable and has bugs in it so now I have to write a different query for the same as I have to fetch only 50 records at a time.
So please can any body help me out for the same?
Thanks in advance.
The query which I have been using is
SELECT PLC.*
FROM
(SELECT
ROW_NUMBER() OVER (ORDER BY PRDLN_CTLG_OID) AS Row,
PRDLN_CTLG_OID,
PRODUCT_LINE_OID AS PRODUCT_LINE_OID,
RTRIM(CATALOG_ID) AS CATALOG_ID,
FROM
PROD_LINE_CATALOG
WHERE
PRODUCT_LINE_OID = :productLineOID AND ACTV_IND = 1
ORDER BY CATALOG_ID) PLC
WHERE
Row >= :startIndex AND Row <= :endIndex
ORDER BY
PLC.CATALOG_ID DESC
WITH UR
use the fetch clause
edit
It looks like you use a startIndex and endIndex value. I realize you compare these to
Row, but do you have another index to compare? If not, and you insist on moving from Row_Number, maybe the table needs another index.