I am trying to select rows with where
condition and will need pagination. So I have added Fetch
with offset
[to make it dynamic] clause but
OFFSET 1 ROWS FETCH NEXT 10 ROWS ONLY
is available from Oracle 12c.
Instead, you need to perform your query and order the data; then generate a row number for the ordered rows; and finally filter on those row numbers. These steps need to take place in the correct order in nested sub-queries:
SELECT *
FROM (
SELECT t.*,
ROWNUM AS rn
FROM (
SELECT up.NAME AS upozilaName_bn,
up.id AS upozila,
dis.NAME AS districtName_bn,
dis.id AS district,
dv.NAME AS divisionName_bn,
dv.id AS division,
w.COUNTER_TYPE,
w.COUNTER_ID,
w.STATUS
FROM X w
left join Y up ON w.UPOZILA = up.ID
left JOIN Z dis ON w.DISTRICT = dis.id
left join P dv ON w.DIVISION = dv.ID
order by upozilaName_bn asc
) T
)
WHERE rn BETWEEN 2 AND 11;