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: Rownum

Re: Rownum

From: <mpir_at_compuserve.com>
Date: Tue, 04 May 1999 20:22:11 GMT
Message-ID: <7gnkte$s90$1@nnrp1.dejanews.com>

PMJI, but why do two sorts?

Just use the outer sort. I don't think you care about the inner one. I also suggest a 'Between' in the where clause.

In article <hFHX2.292$vO1.21289_at_news.tcp.co.uk>,   "Sue French" <sfrench_at_tcp.co.uk> wrote:
> Hi again,
>
> Thanks to all who responded.
>
> However, I've have tried several of these and they all work fine, as long as
> there is no ORDER BY clause. In order for the results to be returned
> correctly, the ORDER BY clause would need to be in the main query and the
> sub query.
>
> As soon as I try to do that, I get an error, e.g.
>
> 1 select id, surname, first_name from
> 2 (select id, surname, first_name, rownum rn
> 3 from telephone_directory where rownum < 15
> 4 order by first_name)
> 5 where rn > 7
> 6* order by first_name
> SQL> /
> order by first_name)
> *
> ERROR at line 4:
> ORA-00907: missing right parenthesis
>
> If I miss off the second ORDER BY, the results are wrong.
>
> The application is such that the web user selects the order that the results
> are returned, and the SQL statement is built dynamically in the JavaScript.
>
> Sue
> ______________________________________________________
> Visit me at http://homepages.tcp.co.uk/~sfrench/
> See you there!
>
>

--
Joseph R.P. Maloney, CCP,CSP,CDP
MPiR, Inc.
502-451-7404
some witty phrase goes here, I think.

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue May 04 1999 - 15:22:11 CDT

Original text of this message

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