Dynamic view with ORDER BY clause

From: Nick Willemse <nwillemse_at_earthlink.net>
Date: Wed, 10 Nov 1999 16:39:58 -0600
Message-ID: <80coj1$jd0$1_at_holly.prod.itd.earthlink.net>



[Quoted] Hi everyone,

I have something gor you guys to think about and it goes something like this: I am selecting from a dynamic view cause I want to select only the first few rows, but I want to first sort it before select the first few rows. Now my SQL looks like this:

 SELECT * FROM

      (SELECT FirstName,
                    LastName
         FROM Person
      WHERE MembershipLevel IN (2,3,4)
          AND FirstNameLower LIKE LOWER(vFirstName)||'%'
          AND LastNameLower LIKE LOWER(vLastName)||'%'
     ORDER BY LastName, FirstName)

 WHERE ROWNUM < 501;

Now here is the problem. This statement works 100% running from SQL/Plus, but as soon as I try to put the code in a package, it gives a compilation error at the ORDER BY line and doesn't compile at all. Now my solution was to change the ORDER BY to a GROUP BY, but still I am unease at why it works in SQL/Plus but not in PL/SQL??? BTW I am using Oracle 8i on a Sun Server.

[Quoted] Thank you in advance for any input.

   Nick Received on Wed Nov 10 1999 - 23:39:58 CET

Original text of this message