| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL problem
In article <3B3BFF52.79D490C8_at_exesolutions.com>, dmorgan_at_exesolutions.com
says...
>
>Since when can you use ORDER BY in a view? Unless that is a brand new feature I
>would suggest a SELECT from a SELECT.
Must be new to 8i; that's the database I'm using to study sql. It's referenced in the SQL Unleashed book, page 540.
As I was studying PL/SQL, I noticed a similar approach that might work for the 7.X database. I don't know of anything that will prevent it from working with 7.X databases, but then, I didn't know that the order by clause was new to 8i, so take that with a grain of salt...
In a nutshell, the logic is as follows:
declare
cursor cursor_name is
select col1, col2, col3
from table
order by col1;
table_rec cursor_name%rowtype;
begin
open cursor_name;
loop
fetch cursor_name into table_rec;
exit when cursor_name%rowcount = ${desired_number}
end loop;
close cursor_name;
Doug
-- ------------------- Douglas K. O'Leary Senior System Administrator dkoleary_at_mediaone.netReceived on Sat Jun 30 2001 - 15:22:26 CDT
![]() |
![]() |