title: Get range of records from SQL query Oracle
body: <p>I want to use this SQL query to get only the records between 8 and 10:</p>
  
  <pre><code>select *
  from(
  SELECT a.*,rownum rn 
  FROM ACTIVESESSIONSLOG  a
  ORDER BY USERID ASC)
  WHERE rn  &gt;= 8 and rn &lt;= 10
  </code></pre>
  
  <p>When I implement this SQL query into pagination I get every time 1 row on the second page no matter how many rows I have configured to be displayed into the pages. Is this SQL query valid?</p>
  
  <p>This is the table structure:</p>
  
  <pre><code>-- TABLE ACTIVESESSIONSLOG
  
  CREATE TABLE ACTIVESESSIONSLOG(
    ASESSIONID VARCHAR2(30 ) NOT NULL,
    USERID VARCHAR2(30 ),
    ACTIVITYSTART TIMESTAMP(6),
    ACTIVITYEND TIMESTAMP(6),
    ACTIVITY CLOB
  )
  /
  </code></pre>
  
  <p>Best wishes</p>