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: Question: Finding the nth row in a table

Re: Question: Finding the nth row in a table

From: Heber Ferraz-Leite <hferraz_at_via.at>
Date: 1997/11/27
Message-ID: <347d83b6.7108801@news.via.at>#1/1

>Heber Ferraz-Leite wrote:
 

>> I had written the follwing:
>>
>> >> select whatever from atable where rownum=n oder by whatever;
>>
>> As others have already stated I made a wrong statement. The above
>> select won't work. It would have been nice, but ...
>>

On Thu, 27 Nov 1997 09:59:30 +0500, Satish Narasimha <satishn_at_blr.sni.de> wrote:

>Hello,
> Can you tell the logic of how you got this idea...?
>
>from
>satish :satishn_at_blr.sni.de
>
>

I have so far used rownum to peek into tables, like in select * from mytable where rownum<10;

I wasn't aware of the way rownum really works. I only knew that it did what I wanted it in the above case.

When the question for the nth row came up I thought that the same way I select the first 10 by sayin rownum<10 I could select the 10th by saying rownum=10.

Then I thought that the table has no order in itself and that the physical order of the rows has nothing to do with the logical order, so I wrote you had to add the oder by.

It was all wrong, but a good learning experience. :-)

(P.S.: To the guy that wrote me an email critizicing my answer but didn't have the guts to use his real name: Yes it was wrong. I will probably never be your DBA. I actually don't work as a DBA but as a sofware developer that knows some SQL, and who sometimes is forced to do a little DBA stuff. I have never been to any oracle training, or any other db training. At least I tried to answer, and not to insult the way you did).

Heber

---
hferraz_at_via.at
Received on Thu Nov 27 1997 - 00:00:00 CST

Original text of this message

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