One common way to return a "page" of record from
Oracle is to use a nested query.  For example: assume
you display 25 records per page, and you wish to
retrieve page 2's records, your query would look
something like this:

SELECT * FROM (
  SELECT * FROM (
    SELECT *, ROWNUM AS RNUM FROM A_TABLE ORDER BY
A_CLAUSE
  ) WHERE ROWNUM <= 50
) WHERE RNUM >= 26

The inner-most SELECT retrieves the records you're
paging and sorts them in the appropriate order.  The
middle SELECT trims off the records after the ones you
want.  The outer SELECT trims off the records before
the ones you want.

This three-step query is necessary in Oracle because
of the way the pseudo-column ROWNUM is assigned
values.

- Bob

--- Philip Tellis <[EMAIL PROTECTED]> wrote:

> Sometime on Jan 27, PIXpDIaC cobbled together some
> glyphs to say:
> 
> > achieve pagination to display result sets queried
> from Oracle in 
> > multiple pages. Is there a plug-in for HTML::
> Template to achieve
> 
> this isn't an HTML::Template problem, this is an SQL
> problem.  Construct 
> your SQL to only return one page of data at a time
> given a start and 
> count.  Not sure how to do it in Oracle, but MySQL
> has a non-standard 
> addition called LIMIT that is added to the end of
> your SQL like this:
> 
> LIMIT 31, 10   (get 10 records starting from the
> 31st)
> 
> -- 
> "Idiot I may be, but tied up I ain't."
>          -- Gaspode the wonder dog
>             (Terry Pratchett, Moving Pictures)
> 
> 
>
-------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do
> you grep through log files
> for problems?  Stop!  Download the new AJAX search
> engine that makes
> searching your log files as easy as surfing the 
> web.  DOWNLOAD SPLUNK!
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Html-template-users mailing list
> Html-template-users@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/html-template-users
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to