Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: ROWNUM problem...

Re: ROWNUM problem...

From: Øyvind Hodne <oeyhodne_at_online.no>
Date: Fri, 1 May 1998 01:39:19 +0200
Message-ID: <6iiv27$ltn$1@o.online.no>


The problem is that ROWNUM is assigned sequentially to each row that meets the criteria. Oracle's SQL Language Reference Manual explains why no rows are selected when you test for ROWNUM values greater than 1 (i.e. ROWNUM > 10):

 "The first row fetched is assigned a ROWNUM of 1 and makes the condition false. The second row to be fetched is now the first row and is also assigned a ROWNUM of 1 and also makes the condition false."

As to how you can retreive the next 10 rows, the easy way is to use PL/SQL, but I suspect that's not what you want. I have never tried this in SQL, so I have absolutely no idea whether it'll work, but you could try the following:

SELECT ROWNUM, MAX(a)
FROM aaa
GROUP BY ROWNUM
HAVING ROWNUM > 10 Received on Thu Apr 30 1998 - 18:39:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US