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

Home -> Community -> Usenet -> c.d.o.tools -> Re: [begonner] Getting a row from a table

Re: [begonner] Getting a row from a table

From: Alex Filonov <afilonov_at_pro-ns.net>
Date: Wed, 15 Nov 2000 22:41:14 GMT
Message-ID: <8uv3e8$jd$1@nnrp1.deja.com>

In article <8uu5su$vjl$1_at_marte.lastminutetour.com>,   "Francesco Marchioni" <Francesco.Marchioni_at_lastminutetour.com> wrote:
> Hello,
> I have a table with 27 records.
>
> SQL> select count(*) from mytable;
>
> COUNT(*)
> ----------
> 27
>
> #so why I don't get anything when I :
>
> select * from mytable where rownum = 25;
> No rows selected
>
> #I also don't get anything when I try
>
> select * from mytable where rownum > 25;
> No rows selected
>
> Thanks in advance.
> --
> Francesco Marchioni
> Java Developer
>
> "In a world without fences, why does one need Gates ?"
> Anonymous
>
>

rownum is a tricky pseudocolumn. It counts records in the output. So query select * from mytable where rownum < 25 will return 24 rows, but your query will return none. You can use inline view to get 25th record:

select * from
 (select m.*, rownum r from mytable m)
where r > 25

By the way, resulting records are random by definition!

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Nov 15 2000 - 16:41:14 CST

Original text of this message

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