Functions returning multiple values with cursors

From: Kurt Milligan <kmilligan_at_dotclick.sss>
Date: Wed, 02 May 2001 08:11:46 -0400
Message-ID: <3AEFF982.17053E44_at_dotclick.sss>


Hi

I have some failry complex SQL statements that I think would probably run faster
as a stored procedure or function. However, the SQL returns multiple rows of multiple values, and I understand that a cursor is required to return multiple values from a function. Unfortuneately, the documentation I've seen on cursors is a bit confusing, so I'd like to present a specific example, and hopefully someone will provide a specific answer...

Here's a simplified SQL statement:

select field1, field2, field3 from mytable where field9 = myvar;

(where field9 = myvar would be true for multiple records) and I would like to know how to exactly how to write a function (let's call it 'myfunction()' for example purposes) using cursors so that I could use another SQL statement like:

select myfunction(myvar) from dual;

which would return the exact same information as the originial SQL, but using the function and hence gaining the benefits of using a compiled statement.

Thank you much in advance.

Kurt Milligan
kmilligan_at_dotclick.sss (replace sss with com) Received on Wed May 02 2001 - 14:11:46 CEST

Original text of this message