Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: URGENT PROBLEM PLEASE SOLVE IN SELECT STMT
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)
![]() |
![]() |