SELECT * FROM
(
SELECT a.*, rownum r_
FROM
(
SELECT * FROM ORDERS WHERE CustomerID LIKE 'A%'
ORDER BY OrderDate DESC, ShippingDate DESC
) a
WHERE rownum < ((pageNumber * pageSize) + 1 )
)
WHERE r_ >= (((pageNumber-1) * pageSize) + 1)
Initially I am passing page number as 1 and page size as 10.
But although I have thousands of records it displays 10 records as desired but my next page button is disabled...
First, you have to select records with rownum start from 1. Which mean if you want to get result for 3 page with 10 items in size, this query should return 30 records.
Second, select from first query result with the boundry that you want to return. Now you can use
between operator. From (Page Number * Size) to ((Page Number + 1) * Size)
No matter how much time you spend on coding. Wish you happy coding.
My Technical Blog
CsharpAsp.ne...
Member
136 Points
465 Posts
getting total records
Jan 25, 2013 05:40 AM|LINK
Hi,
I am binding my jquery to stored procedure.
SELECT * FROM
(
SELECT a.*, rownum r_
FROM
(
SELECT * FROM ORDERS WHERE CustomerID LIKE 'A%'
ORDER BY OrderDate DESC, ShippingDate DESC
) a
WHERE rownum < ((pageNumber * pageSize) + 1 )
)
WHERE r_ >= (((pageNumber-1) * pageSize) + 1)
Initially I am passing page number as 1 and page size as 10.
But although I have thousands of records it displays 10 records as desired but my next page button is disabled...
how can i fix this
CruzerB
Contributor
5399 Points
1098 Posts
Re: getting total records
Jan 25, 2013 09:12 AM|LINK
Hi,
Since ROWNUM always start from 1.
My Technical Blog