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: Rachel Carmichael <rachel.carmichael_at_citicorp.com>
Date: 1998/02/23
Message-ID: <34F18ED6.75FFDABF@citicorp.com>#1/1

Try "order by 1" -- this will order by the first column returned, which is essentially what you want.

Rachel

Quentin North 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.
Received on Mon Feb 23 1998 - 00:00:00 CST

Original text of this message

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