Home   My Faqts   Contributors   About   Help   Link to FAQTS  

faqts : Computers : Databases : Oracle

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

86 of 102 people (84%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How to do paging with query results, i.e display first 10 row from the query and next 10 with a clic

Sep 12th, 2002 00:43
swathi Bahavani,


In the following example, the inner select query which is named as 'a' 
can be any thing with joins, order by clause etc..
The outer selec clause should be as given below.

The  gHigherBound  and gLowerBound can be like 10 and 1 respectively. 
and these will be changed on click of a next button to display the next 
set of rows.

        query := 'select *
                      from  ( select a.*, rownum r
                              from (
                                    select
                                            E.Name,
                                            E.ID,
                                    from Employee E
                                    group by  E.Name,E.ID
                                    ) a
                              where rownum <= '|| gHigherBound ||'
                            ) b
                      where r > '|| gLowerBound ||'';