Navigation

RSS 2.0 New Entries Syndication Feed Atom 0.3 New Entries Syndication Feed

Show blog menu v

 

General

Use it

Documentation

Support

Sibling projects

RIFE powered

Valid XHTML 1.0 Transitional

Valid CSS!

Blogs : Latest entries

Limit and offset in Oracle

Shameless plug - I need your help

Please vote for my band Flytecase at http://vote.flytecase.be.

Your support can provide us with a record deal and numerous high profile concerts!

For quite a while I've been frustrated with Oracle's lack of doing limit and offset in an easy single query. This always made it tedious to display paged results from a database query in a web page. Today, after looking on the web for the xth time, I stumbled into a query that seems to solve this.

So without further ado, here it is for those that have been searching for it also:

SELECT * FROM (
    SELECT ROW_NUMBER() OVER(ORDER BY column1) LINENUM, column1, column2
    FROM MyTable
    ORDER BY column1
)
WHERE LINENUM BETWEEN 100 AND 200;
posted by Geert Bevin in Computing on Jan 25, 2004 12:42 PM : 11 comments [permalink]
 

 
 
 
Google
rifers.org web