Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Why ORA-01785 ORDER BY item must be the number of a SELECT-list expression?

Re: Why ORA-01785 ORDER BY item must be the number of a SELECT-list expression?

From: Chrysalis <cellis_at_iol.ie>
Date: 1997/07/17
Message-ID: <33CDF53D.926@iol.ie>#1/1

Poon Chak Yau wrote:
>
> Hello,
> I have an union statement that have an order-by clause.
> However, I get error ORA-01785. Do you know why it requires me to
> specify the order by column number instead of column name? In fact,
> why Oracle ask for that? Is there any situation that column name is
> not possible?
>
> Regards,

Consider:
select a,b,c from X
UNION
select e,f,g from Y
order by ?

It is clear that a column name is not appropriate in the order by clause. You *must* use position numbers, e.g. order by 3,1.

HTH

-- 
Chrysalis

FABRICATI DIEM, PVNC
('To Protect and to Serve')
Terry Pratchett : "Guards Guards"
Received on Thu Jul 17 1997 - 00:00:00 CDT

Original text of this message

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