Re: <Q.> Stored Procedure?

From: Simon Morley <morleys_at_entcf2.agw.bt.co.uk>
Date: 1997/11/07
Message-ID: <3462db31.601808204_at_news.axion.bt.co.uk>#1/1


On Fri, 07 Nov 1997 06:15:07 GMT, kev_at_kconcept.com (KevSter) wrote:

>I tried that also and still the same errors.
>
>The statement I used is:
>
>create procedure test
> as
> begin
> select * from whatever;
> end;
>/
>
<snip>

[Quoted] You cannot use select in this way within a stored procedure. To acheive what you require you can either select INTO a variable (if your select returns one row) or use a cursor. If you use a cursor you then need open, fetch each row and close the cursor or use a cursor for loop.

eg

create or replace procedure x as

        cursor mycur is select * from table;

begin

	for i in mycur 
	loop

		-- do your processing here

	end loop;

end; Received on Fri Nov 07 1997 - 00:00:00 CET

Original text of this message