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: oracle rownum

Re: oracle rownum

From: Martin T. <0xCDCDCDCD_at_gmx.at>
Date: Tue, 21 Aug 2007 18:34:48 +0200
Message-ID: <46cb143d$0$1346$834e42db@reader.greatnowhere.com>


odelya wrote:
>
> Tha sort is not by the ID - it's by another parameter in the table
> (date..)
>

Maybe Analytic Functions can help:

select * from (
SELECT some_table.*, lead(ID) over (order by date) as LEAD_ID, lag(id) over (order by date) as LAG_ID
from some_table
) some_table_plus
where ID = :search_id

    or LEAD_ID = :search_id
    or LAG_ID = :search_id
order by date

br,
Martin Received on Tue Aug 21 2007 - 11:34:48 CDT

Original text of this message

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