Using Rownum and ROwid returns duplicate records
578402May 18 2007 — edited May 18 2007Hi All,
We have implemented pagination as below using rowid and rownum
SELECT
id
FROM
emp
WHERE
(
ROWID IN
(
SELECT RID FROM (SELECT
ROWID RID,
ROWNUM RNUM
FROM
SELECT ID FROM emp
WHERE
((T_ID IN (200005,200229,200230,200249,200250,200049))) AND
(dte >= sysdate-90) AND
(LOWER(DESC) = LOWER ('A') AND
LOWER(NVL(FLAG,'0')) != LOWER ('3') AND
LOWER(MODDE) like LOWER ('%210%')) ORDER BY dte ASC ))
WHERE ROWNUM < 11) WHERE RNUM>= 1)) ORDER BY dte emp.ASC
But, we face that - the query inserts duplicate records in consecutive pages. For Eg:
1.if a,b,c,d,e - is returned for first iteration, then for the next iteration - f,g,h,a,y is returned.
Is it because that the Order by clause doesnt have a Unique key column.
Please help. or suggest how to efficietly implement pagination without performance hit