Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get range of rows from a table.

Status
Not open for further replies.

lakshmivaragan

Programmer
Sep 30, 2003
25
IN
Hi,
Is there any way to get a range of rows from a table.
For e.g to get rows 10 to 15 from a table ?

(ROWNUM is no good. Since > wont work with ROWNUM. We cant have query like this
SELECT * FROM EMP WHERE ROWNUM > 10 and ROWNUM < 15
)

Is there any other way ???

Regs
Lax
 
Use Inlineviews:
SELECT what,you,need
FROM (SELECT rownum rn,t.*
FROM yourTable t
WHERE yourCondition=true
ORDER BY sortfield)
WHERE rn between 10 and 15
Better use the analytic row_number-function instead of the rownum-pseudocolumn if you don't work on a simple table (use aggregatefunctions, joins,...).

Stefan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top