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: selecting specified rows from a view using rownum

Re: selecting specified rows from a view using rownum

From: Jörn Fieg <fieg_at_wmd.de>
Date: 1997/12/02
Message-ID: <34845F2A.BDEC133C@wmd.de>#1/1

--------------81865EF6F3CC2EBA3BBF2591
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi Frank

Frank Curti wrote:

>  I am working on a web based application using Netscapes Livewire and Oracle
> 7.3.  I create a view based on a query and I need to be able to get 25 rows
> at a time.  When I make the following query it does not work.
>
> select * from view1 where rownum <= 50 intersect select *
>                                          from view1 where rownum >= 25;
>
> The Oracle documentation is pretty clear why it does not work(it says the
> second select statement assigns a rownum value equal to 1 which makes the
> rownum >= 25 statement false) but does not tell me how to work around the
> problem.  Can I some way still use rownum or is there a way I can insert
> another column into the view?
 

> Thanks in advance,
> Frank Curti

 How about:

select * from view1 where rownum <= 50
minus
select * from view1 where rownum <= 25;

Not really performat, but working.

CU, Jörn

--------------81865EF6F3CC2EBA3BBF2591
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>

Hi Frank

<P>Frank Curti wrote:
<BLOCKQUOTE TYPE=CITE>&nbsp;I am working on a web based application using
Netscapes Livewire and Oracle
<BR>7.3.&nbsp; I create a view based on a query and I need to be able to
get 25 rows
<BR>at a time.&nbsp; When I make the following query it does not work.

<P>select * from view1 where rownum &lt;= 50 intersect select *
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
from view1 where rownum >= 25;

<P>The Oracle documentation is pretty clear why it does not work(it says
the
<BR>second select statement assigns a rownum value equal to 1 which makes
the
<BR>rownum >= 25 statement false) but does not tell me how to work around
the
<BR>problem.&nbsp; Can I some way still use rownum or is there a way I
can insert
<BR>another column into the view?</BLOCKQUOTE>

<BLOCKQUOTE TYPE=CITE>

<P>Thanks in advance,
<BR>Frank Curti</BLOCKQUOTE>

&nbsp;How about:

<P>select * from view1 where rownum &lt;= 50
<BR><B>minus</B>
<BR>select * from view1 where rownum &lt;= 25;

<P>Not really performat, but working.

<P>CU, J&ouml;rn</HTML>

--------------81865EF6F3CC2EBA3BBF2591-- Received on Tue Dec 02 1997 - 00:00:00 CST

Original text of this message

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