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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How do I view a block of n rows anywhere in the table?

Re: How do I view a block of n rows anywhere in the table?

From: Mark Gumbs <mgumbs_at_nospam.hotmail.com>
Date: Thu, 3 Jun 1999 16:36:52 +0100
Message-ID: <37569edd.0@145.227.194.253>


Sorry, forgot to mention...

The only other way is to run your initial query, save results to a temp table with an added column called seq, which stores sequential numbers 1,2,3 etc. In your app, use this sequence to return the values you reqiire. This way, the only hold up is the returning the rows from your initial 'big' query and not re-doing the same stuff after every range change.

e.g

create sequence temp_seq start with 1;

create table temp_vals as
select temp_seq.nextval, empno, ename from emp;

Then...

select empno, ename
from temp_vals
where seq >= 20
and seq < 30;

Be sure that seq is indexed!

M

Steven Franklin wrote in message <37568A1A.A52F62C6_at_wcom.com>...
>I'm trying to look at block of n rows anywhere within the table. i.e.
>I don't want to format 250K rows for display in HTML. Rather, I'd like
>to be able to format and display a block of say 10 rows at a time and
>skip around through the table.
>
>This method seems to work, but it gets very slow when trying to
>look at rows further into the table.
>
>SELECT driver.key1,
> driver.key2,
> col1,
> col2
>FROM tbl,
> (SELECT /*+ INDEX(tbl idx_key2) */
> rownum rn,
> key1,
> key2
> FROM tbl
> WHERE rownum <= UpperRow) driver
>WHERE (tbl.key1=driver.key1) AND
> (tbl.key2=driver.key2) AND
> (rn >= LowerRow)
>
>where idx_key2 is an index with the desired sort order. And UpperRow and
>LowerRow define the boundries of the block want to look see.
>
Received on Thu Jun 03 1999 - 10:36:52 CDT

Original text of this message

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