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: [Q] Why cant I ORDER BY on a SELECT...UNION in PL/SQL

Re: [Q] Why cant I ORDER BY on a SELECT...UNION in PL/SQL

From: <smoore_at_accordhr.com>
Date: 1998/02/24
Message-ID: <6cut5l$ot1$1@nnrp1.dejanews.com>#1/1

In article <888240456.3424.0.nnrp-06.9e98628b_at_news.demon.co.uk>,   "Quentin
North" <quentinn_at_epic.co.uk> wrote:
>
> Why wont this work in pl/sql (but

 will otherwise):
>
> select col1,col2 from tab1
> union
> select col1,col2

 from tab2
> order by col1;
>
> Get message PLS-00423: ORDER BY item must be
 the number of a SELECT-list
> expression
>
> Oracle support in the UK dont

 appear to know why it wont work. Everything
> works until you add the order

 by clause.
>
>

Try using the position of the column instead of the name. In your example,

select col1,col2 from tab1
union
select col1,col2 from tab2
order by 1

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Tue Feb 24 1998 - 00:00:00 CST

Original text of this message

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