Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL puzzler
On Wed, 28 Jan 1998 14:02:03 -0600, "Charles A. Christiansen, Jr." <charles_at_iconstructs.com> wrote:
>Hi all,
>
>I'm having a bit of trouble getting an ORDER BY clause into a cursor.
>This is my PL/SQL code:
>
>CURSOR c_ipf IS (SELECT EntryID, OrderNum FROM T1
> WHERE MainID = Main_ID AND ParentID = Parent_ID AND LevelNum =
>Level_Num AND OrderNum >= Order_Num
> ORDER BY OrderNum DESC);
>
>What I get from the compiler is:
>
>PLS-00103: Encountered the symbol "ORDER" when expecting one of the
>following: .()*@%& (. . .) the symbol ")" was substituted for "ORDER" to
>continue.
>
Hi Charles,
with that outer pair of brackets around your cursor declaration, Oracle obviously assumes it is a subquery or an inline view, in which ORDER BY is not allowed. If you remove these brackets, it should work all right.
HTH
Peter
-- Peter Schneider peter.schneider_at_okay.netReceived on Wed Jan 28 1998 - 00:00:00 CST