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: URGENT PROBLEM PLEASE SOLVE IN SELECT STMT

Re: URGENT PROBLEM PLEASE SOLVE IN SELECT STMT

From: Jurij Modic <jmodic_at_src.si>
Date: Fri, 28 Aug 1998 14:08:34 GMT
Message-ID: <35e6b91a.2828529@news.siol.net>


On Fri, 28 Aug 1998 08:50:03 -0500, Sreenivas <knsvas_at_hotmail.com> wrote:

>Hi,
>
> I used the following query as cursor in creating a package body:
>
> select clli_org, trk_org, node_org
> from trunklis
> where trk_date='23-aug-98'
> minus
> select clli_org,trk_org,node_org
> from trunklis
> where trk_date='16-aug-98'
> order by node_org;
>
>it is giving the following error:
>order by item must be in Select-list expression.
>
>If i run the same query at SQL prompt, it is working fine.
>
>Can any one tell me What is the possible reason for this?

In PL/SQL, you must still use positional notation for the ORDER BY in a UNION (this also applied for SQL in previous releases). So instead of your

> order by node_org;

use: ORDER BY 3;

This tells Oracle to sort by the third column in the select list.

HTH,
--
Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Fri Aug 28 1998 - 09:08:34 CDT

Original text of this message

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