Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> first N rows with a cursor
As has been pointed out on this newsgroup several times recently,
select * from
(select ename from emp group by ename order by ename desc)
where rownum <= 10;
retrieves the first 10 rows from the inner query. However, if you try to open a cursor on this statement in Oracle 8.1.5.0.0, using
declare
cursor ecurs is
select * from
(select ename from emp group by ename order by ename desc)
where rownum <= 10;
begin
...
end
you get an error:
PLS-00103: Encountered the symbol "ORDER" when expecting one of
the following:
. ( ) , * @ % & - + / mod rem with an exponent (**) group
having intersect minus start union where connect ||
The symbol ")" was substituted for "ORDER" to continue.
Is there a known way around this? Is there some kind of incompatibility between PL/SQL and SQL?
Thanks in advance,
Jeff
Received on Thu May 11 2000 - 00:00:00 CDT