Web page that retrives data from SQL database and display it to the user in well formatted manner. Data retrieved depend upon criterias selected by the user. But sometimes data retrieved is very large.
So need to display records to the user page wise, i.e. 100 records on first page and next 100 records displayed when user clicks next button.
Use below query set:
select *
from ( select a.*, rownum rnum
from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
where rownum <= MAX_ROWS )
where rnum >= MIN_ROWS
and for testing create one table then inserted data using follwing query,
CREATE TABLE ORAFAQ(
EMP_COD NUMBER
)
insert into oraFaq
select level+100 from dual
connect by level<100
now table Ora_Faq has 100 rows, I would like to cut the result set into 4, each of 25 record. and I would like to give sequence number to each record.so i executed following query.
select *
from ( select a.*, rownum rnum
from ( SELECT * FROM oraFaq order by EMP_cOD ) a
where rownum <= 25 )
where rnum >=1