Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting the first row using ORDER BY
> Oracle assigns the values of the pseudocolumn ROWNUM before it applies
> the ORDER BY clause. How would one obtain the first row of the ordered
> result set ?
>
> One solution is to declare a cursor using the ORDER BY clause. Then by
> opening
> the cursor and fetching only the first row, this row may be obtained.
> This seems
> sloppy, however.
>
> Any suggestions ?
select * from ( select .... order by...) where ROWNUM=1;
Eddy. Received on Mon May 11 1998 - 08:47:27 CDT
![]() |
![]() |