Question
i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Question Submitted By :: Shaikrafi
I also faced this Question!!
Rank
Answer Posted By
Re: i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Answer
# 1
If your intention is to dislay only 100 records to the
user, then better make the change the query to retrieve
first 100 recs. (like say fetch first 100 rows in Db2).
A Kumar
Re: i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Answer
# 2
ResultSet.getRow() will give you the row number where the
resultset cursor is in , check for ResultSet.getRow()==100
and then break out of the loop
Sri
Re: i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Answer
# 3
GO ON LINK JAVATEACHER.CO.IN AFTER THAT CLICK JSP ,,,,THERE
IS AN EXAMPLE OF PAGINATION SHOW THAT EXAMPLE THAT IS
PERFECT EXAMPLE FOR U
Saket
Re: i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Answer
# 4
the is a syntax in sql 'limit'....using this u can get
desired number of rows...
suppose database having 1000 rows..
query will be:
select * from table limit 100;
first 100 rcds will be selected...
Ravi
Re: i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Answer
# 5
query should be prepare like this
select * from tab_name where rownum <= 100
Dmk.java@gmail.com
Re: i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Answer
# 6
SELECT TOP 100 from MyTable;
Kuldeep Raaj Sharma
Re: i have 1000 records in resultset, how to get first 100
records from resultset, because resultset fetch all 1000
records at a time?
Answer
# 7
There is two ways to getting the limited records from the
DB.
1)we can use sql command :
set rowcount 100 select * from mytab.
2)Instead of set rowcount you can use setMaxRow(100) method.
Chandra