Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: ROWNUM question
This is kind of hard to understand. At least to me but kind of makes
sense. The book (Oracle8: The Complete Reference) says "<rownum> is the
number of each row counted as it is retrieved from the database" (page
412) This implies that a query that asks for rows between x and y can
not succeed because the rows selected always start with the number 1.
Carlos.
In article <7tivmp$8pq$1_at_nnrp1.deja.com>,
rspeaker_at_my-deja.com wrote:
> I have a table with just under 1.5 MM records in it, and wanted to
> insert a subset of those columns and data to another table. I realize
> PL/SQL would be the most efficient way to do this, but at this point,
is
> not my forte'. I chose to do it in chunks using SQL*Plus.
>
> I first issued insert into tab1 (select * from tab2 where rownum <
> 100000); to get the first 100,000 records. No problem. I then issued
> insert into tab1 (select * from tab2 where rownum between 100001 and
> 250000); and got 0 records. Then I tried insert into tab1 (select *
> from tab2 where rownum >100000 and rownum <= 250000); and again got 0
> records. Finally I truncated tab1 and did insert into tab1 (select *
> from tab2 where rownum <= 250000); and got 250,000 records.
>
> Can anybody tell me why? Is there something magical about rownum that
> you cannot use it in compound comparisons?
>
> Thanks.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Oct 07 1999 - 16:44:44 CDT
![]() |
![]() |