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: ROWNUM question

Re: ROWNUM question

From: <cpereyra_at_ix.netcom.com>
Date: Thu, 07 Oct 1999 21:44:44 GMT
Message-ID: <7tj488$c48$1@nnrp1.deja.com>


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

Original text of this message

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