Home » SQL & PL/SQL » SQL & PL/SQL » Row count
Row count [message #36200] Fri, 09 November 2001 09:30 Go to next message
Panneer Selvam
Messages: 7
Registered: November 2001
Junior Member
I have a table with 100 rows.I need to select 10 rows at a time . ie first from 1 to 10 , 11 to 20 and so on.

I tried the following query.

SELECT * FROM table WHERE ROWNUM BETWEEN 1 AND 10

The above query worked but the following didn't

SELECT * FROM table WHERE ROWNUM BETWEEN 11 AND 20

Pl. help

----------------------------------------------------------------------
Re: Row count [message #36201 is a reply to message #36200] Fri, 09 November 2001 09:42 Go to previous messageGo to next message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
try this:

select * from (select rownum rnm,col_name from table) a
where a.rnm between 11 and 20;

----------------------------------------------------------------------
Re: Row count [message #36203 is a reply to message #36200] Fri, 09 November 2001 09:47 Go to previous messageGo to next message
James Bradburn
Messages: 4
Registered: November 2001
Junior Member
You could use a cursor to get all the rows and cycle through them in groups of ten. More details would allow the best solution to be found.

----------------------------------------------------------------------
Re: Row count [message #36205 is a reply to message #36201] Fri, 09 November 2001 10:06 Go to previous message
Panneer Selvam
Messages: 7
Registered: November 2001
Junior Member
Thankyou Suresh

----------------------------------------------------------------------
Previous Topic: Droping Temporary Table
Next Topic: COLUMN INTO ROWS AND VICE VERSA
Goto Forum:
  


Current Time: Tue May 28 05:57:24 CDT 2024