Re: Problem with a simple SQL query!

From: <bhogak_at_my-dejanews.com>
Date: 1998/10/01
Message-ID: <6uunon$13p$1_at_nnrp1.dejanews.com>#1/1


Hi! It doesn't make any difference to oracle the order in which you inserted your recs. It means, it is not always true that older recs are retrieved first than later ones or so, oracle fetches the recs the way it pleases unless you explicity use an order by clause. So an order by in the select statement used in an insert doesn't make any sense to oracle. However, if you are particular of sorting the recs before insert, may be you should try a cursor using an order by clause there. Hope this helps. Kumar In article <6ustkf$cd311_at_kirk.tinet.ie>, "The Phantom" <tmaguire_at_nospam.tinet.ie> wrote:

> Hi
>
> Could any please help me with this SQL statement. It seems OK but it returns
> the following error:
>
> order by sedol
> *
> ORA-00933: SQL command not properly ended
>
> Here is the statement:
>
> insert into t_sedol (sedol)
> select sedol from t_master_download
> where rownum<=246
> and country='United Kingdom'
> and downloaddate='01-DEC-92'
> order by market_cap desc;
>
> So basically I want to insert the 'sedol' value(s) into the table 't_sedol'.
> The 'sedol' value(s) is a SELECT query that chooses its data from the table
> 't_master_download'. When I remove the ORDER part of the statement it runs
> fine but the ORDER is essential. Can anyone help on this one?
>
> Regards
>
> Terry Maguire
> IIU
> IFSC House
> Custom House Quay
> Dublin 1
> Ireland
> e:Mail - tmaguire_at_nospam.gandon.ie
> ---Remove the nospam to e:Mail
>
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Thu Oct 01 1998 - 00:00:00 CEST

Original text of this message