Connecting Tech Pros Worldwide Forums | Help | Site Map

Oracle Noob need help with function

spawncamper
Guest
 
Posts: n/a
#1: Jul 19 '05
Hi -

I posted here a few weeks back and people were kind enough to help.
In lieu of my PL/SQL class I take in a few weeks, I was hoping to get
some more advice.

Here's my scenario: I need a function to return a table of data for
Oracle8i.
I'm fairly certain of the stucture for the function, but am hazy on
the details.

CREATE OR REPLACE FUNCTION test_function (id in varchar2)

return table ****i know this isn't correct

IS

TYPE ref0 IS REF CURSOR;
cur0 ref0;

BEGIN

OPEN cur0 FOR
select id, name from user where id = id;

*****PERFORM SOME SORT OF LOOP AND ASSIGN TO VARIABLES - AM HAZY
HERE****

return table;
end;

Any assistance is greatly appreciated. Thank you for your time.

Mark D Powell
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Oracle Noob need help with function


jerel@rockbaby.com (spawncamper) wrote in message news:<f2f4fe50.0407271157.189f42ff@posting.google. com>...[color=blue]
> Hi -
>
> I posted here a few weeks back and people were kind enough to help.
> In lieu of my PL/SQL class I take in a few weeks, I was hoping to get
> some more advice.
>
> Here's my scenario: I need a function to return a table of data for
> Oracle8i.
> I'm fairly certain of the stucture for the function, but am hazy on
> the details.
>
> CREATE OR REPLACE FUNCTION test_function (id in varchar2)
>
> return table ****i know this isn't correct
>
> IS
>
> TYPE ref0 IS REF CURSOR;
> cur0 ref0;
>
> BEGIN
>
> OPEN cur0 FOR
> select id, name from user where id = id;
>
> *****PERFORM SOME SORT OF LOOP AND ASSIGN TO VARIABLES - AM HAZY
> HERE****
>
> return table;
> end;
>
> Any assistance is greatly appreciated. Thank you for your time.[/color]

Look in the PL/SQL manual. It is available free online via several
sites including technet.oracle.com (PDF downloads) and
tahiti.oracle.com which provides online search capability.

HTH -- Mark D Powell --
cs
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Oracle Noob need help with function


Hi

you can use pipelined functions

check for pipelined functions on asktom.oracle.com

hope this is helps

ss
Closed Thread


Similar Oracle Database bytes