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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Extracting parts of SQL query

Re: Extracting parts of SQL query

From: Marin Dimitrov <marin_at_sirma.bg>
Date: Thu, 1 Jun 2000 11:45:04 +0300
Message-Id: <10515.107371@fatcity.com>


> MySQL offers a nice feature - the LIMIT clause, e.g.
>
> select .... from tablename LIMIT m,n
>
> delivers the next n rows starting from offset m.

  1. to set an upper limit N of the resultset u may use
select ...
from ...
where ...
        and  ROWNUM <= N


2. to set both lower and upper limit u could use something like :

select * from

    (select tablename.* , rownum RNUM

     from tablename
     where ...
        and rownum <= N

    )
where RNUM >= M;

NOTE : u can't just use

    where ...

                and ROWNUM <= N
                and ROWNUM >= M

 because the last restriction is always true  

>I think JDBC offers this this functionallity !?

I don't think so.

best wishes,

    Marin


"When brought to meaning, all importance becomes small, as in death, all life seems nothing. Knowing is destroyed by thinking, distilled into knowledge"

                                                 William Wharton, "Birdy"
Received on Thu Jun 01 2000 - 03:45:04 CDT

Original text of this message

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