It's forward-generated on the fly as records are pulled from the table
(before being sorted). So
your criteria of where rownum >10000 doesn't work, neither does rownum
>1000000 and rownum <= 250000,
because the >100000 part never really gets evaluated, because it isn't
really kept associated with the table (that's why it's called a
"pseudocolumn". "creating" it as part of a subquery makes it a little bit
more real.
Try this bit of subquery funness:
select a.col1, a.col2, a.col3, ...
from (select rownum as rnum, * from tab2) as a
where a.rnum between 100000 and 250000;
--
Corey Lawson
clawson_at_bogusucsd.edu
(remove the 'bogus', as it's my feeble attempt
to defeat spammer address suckers)
rspeaker_at_my-deja.com wrote in message <7tivmp$8pq$1_at_nnrp1.deja.com>...
>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.
Received on Thu Oct 07 1999 - 16:18:11 CDT