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: Retrieve N record from a large table...

Re: Retrieve N record from a large table...

From: Eike J. Heinze <eike.heinze_at_compuware.com>
Date: Thu, 02 Sep 1999 14:34:00 -0500
Message-ID: <37CED128.1388082E@compuware.com>



Hi;

The only way I know of would be a PL/SQL procedure.
Write a cursor, read and count the rows until you have it.
But please: WHY this? Did somebody throw a Cobol (or whatever...) program and it's data into Oracle? Never worked...

Regards
Eike

Jimmy wrote:

Hello all,

    I have a table AAA with over 50000 rows. Assume the table structure
of table AAA is as follows:

    a    number;
    b    varchar2(100);
    c    varchar2(100);

    Now I want to retireve the N record of this table by using the
following SQL statement in SQL*Plus:

    select whole_str from (select a || b || c whole_str, rownum rowno
from AAA) where rowno = &N;

    It returns a string with A + B + C with record number N in table
AAA. However, the time to do this query, as I expected, takes so long to
run.
    (in fact, in my case, the table AAA may have over 30 columns)

    How can I rewrite this SQL statement such that it can improve the
query time? Can I get the same results by using rowid? (I think using
rowid is the fastest way)

Thanks,
Jimmy


Received on Thu Sep 02 1999 - 14:34:00 CDT

Original text of this message

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