Re: Can a procedure contain only a SELECT statement?

From: Mladen Gogala <mgogala_at_no.address.invalid>
Date: Thu, 18 Mar 2010 13:17:23 +0000 (UTC)
Message-ID: <hnt952$c72$5_at_solani.org>



On Wed, 17 Mar 2010 21:37:44 -0700, ddf wrote:

> create or replace procedure aSimpleSelect (aLikeValue char(4)) as
> myrec aTableName%ROWTYPE;
> begin
> select *
> into myrec
> from aTableName
> where aColumn = aLikeValue
> and rownum < 2;
> end;
> /

Nope. This is the right answer:

create or replace function aSimpleSelect (a_like_value char(4)) return ref cursor as
v_csr ref cursor;
begin
open v_csr for
  select *
  from aTableName
 where aColumn = a_like_value;
return(v_csr);
end;
/

-- 
http://mgogala.byethost5.com
Received on Thu Mar 18 2010 - 08:17:23 CDT

Original text of this message