Re: insert statement using order by

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: 1999/10/13
Message-ID: <939834220.19338.0.nnrp-11.9e984b29_at_news.demon.co.uk>#1/1


Is there any reason why you can't store the counter in the temporary table, and use it in the JDBC e.g.

create global temporary glob_temp1 (

    id_seq number,
    etc.
);

insert into glob_temp1 (

    id_seq,
    etc.....
)
select rownum, t.*
from (

    your select statement with order by
) t
;

This should work in 8.1 which allows order by in views, hence in-line views.

Then you can do:

    select * from glob_temp
    where id_seq between{M} and {N}
;

(PS - I've just tested this on 8.1.5, which version of 8.1 are you running ? -- The bug is that it's in 7.3, it wasnt' supposed to exist until 8.1).

--

Jonathan Lewis
Yet another Oracle-related web site:  http://www.jlcomp.demon.co.uk

Stephen Pillow wrote in message

>> I would like to be able to take data from one table and put the data in
>> another table sorted. I have attempted to use the "insert into tablename
>> (select * from othertable order by desc)". However, Oracle 8 and 8i do
not
>> support this(it is a bug). Oracle did support the use of order by in a
sub
>> query in release 7.3.4.
>>
Received on Wed Oct 13 1999 - 00:00:00 CEST

Original text of this message