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: Shakespeare <whatsin_at_xs4all.nl>
Date: Tue, 21 Aug 2007 16:41:55 +0200
Message-ID: <46caf9b5$0$244$e4fe514c@news.xs4all.nl>

"odelya" <be.special_at_gmail.com> schreef in bericht news:1187707113.026004.54970_at_19g2000hsx.googlegroups.com...
> On 21 , 17:18, "Shakespeare" <what..._at_xs4all.nl> wrote:
>> "odelya" <be.spec..._at_gmail.com> schreef in
>> berichtnews:1187705463.959604.54720_at_k79g2000hse.googlegroups.com...
>>
>>
>>
>>
>>
>> > Hi,
>>
>> > I have a question about rownum which is not mentioned.
>>
>> > Lets say that I want to extract a 3 records out of a result where the
>> > middle one is the query.
>> > For example:
>> > I have records:
>> > ID Value
>> > 1 Hello
>> > 2 Hi
>> > 3 Wow
>> > 4 Shrek
>> > 5 Shus
>> > 6 What?
>>
>> > And I need a query that by receiving ID, it will extract the record
>> > with the id and the previous one to that and the next one.
>> > For example for selecting ID=4, it will return records: 3,4,5.
>>
>> > Is there a way to do it in Oracle?
>>
>> where id between <yourval> -1 and <yourval> +1 ?
>>
>> Shakespeare- -
>>
>> - -
>
> Well,
> But the ids are not seqeuntial - it can verify from each record..
> For exampe:
> ID Value
> 225 Hello
> 228 Hi
> 258 Wow
> 240 Shrek
> 259 Shus
> 230 What?
>

I was already affraid of that.... would be to simple, right? But what is determining your sort order then? ROWID? Be aware that rownum should be meaningless....

Shakespeare Received on Tue Aug 21 2007 - 09:41:55 CDT

Original text of this message

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