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: SQL problem

Re: SQL problem

From: Doug O'Leary <dkoleary_at_mediaone.net>
Date: Sat, 30 Jun 2001 20:22:26 GMT
Message-ID: <MPG.15a7f2321a140a589897a9@news.randori.com>

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;

end;

Doug

-- 
-------------------
Douglas K. O'Leary
Senior System Administrator
dkoleary_at_mediaone.net
Received on Sat Jun 30 2001 - 15:22:26 CDT

Original text of this message

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