Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Simple Query Help

Re: Simple Query Help

From: Bob Fazio <rfazio_at_home.com.nospam>
Date: 2000/05/26
Message-ID: <YOuX4.209853$Tn4.1867277@news1.rdc2.pa.home.com>#1/1

You can't use an order by in a subquery.

The ORDER BY clause is subject to the following restrictions:

If the ORDER BY clause and the DISTINCT operator both appear in a SELECT statement, the ORDER BY clause cannot refer to columns that do not appear in the select list.
The ORDER BY clause cannot appear in subqueries within other statements. The ORDER BY clause can contain no more than 255 expressions.

--
Robert Fazio, Oracle DBA
rfazio_at_home.com
remove nospam from reply address
http://24.8.218.197/
"Gabriel Millerd" <millerd_at_ns1.rli-net.net> wrote in message
news:8gjoff$f4a$1_at_news.powerisp.com...

>
> What is wrong with this query?
>
> select * from (select a from tablename where b = 1 order by ts desc) where
rownum < 100
>
> I get a ORA-0097: missing right parenthesis.
>
> This works just fine however (but not what i want)
>
> select * from (select a from tablename where b = 1) where rownum < 100
>
> Is there an easier way or a work around?
>
> ---
> Gabriel Millerd | Let them hate, so long as they fear. -Lucius
> Sith Admin | Accius, Fragment
> http://sabbat.org |
Received on Fri May 26 2000 - 00:00:00 CDT

Original text of this message

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