Re: how to return a record from pl/sql function

From: web guy <web-guy01_at_attbi.com>
Date: Tue, 11 Feb 2003 13:30:06 GMT
Message-ID: <yV62a.72795$Ec4.63791_at_rwcrnsc52.ops.asp.att.net>


Yes that is what I want to do, but I can't determine what to put as the return value for the function in the package body.

If in my package my_pkg I define a record:

type my_rec is record (
  field1 char,
  field2 number,
  filed3 varchar2);

and the function:

function f_my_function (userfield IN VARCHAR2)   return my_rec;

This compiles (in JDeveloper).

When I build the package body:

package body my_pkg as

  function f_my_function (userfield IN VARCHAR2)   return theData my_pkg.my_rec
  as
    cursor .....

The compiler does not like the return theData my_pkg.my_rec

So I do I return the record to the Oracle Form that called the function?

thank you.
"Ethel Aardvark" <bigjobbies_at_hotmail.com> wrote in message news:1a8fec49.0302110214.32fa2bd6_at_posting.google.com...
> Tim,
>
> I haven't done this for a while, but can't you define a record type in
> the package and use that as the package-level data type rather than
> using the cursor type?
> The function could copy fields from the cursor to the record a field
> at a time, but everywhere else would see it as a single variable (of a
> record type).
>
> Sorry, no example and no real chance to try it!
>
> Regds,
>
> ETA
>
> (P.S., Hope this makes sense!)
>
> "web guy" <web-guy01_at_attbi.com> wrote in message
news:<rlV1a.66158$vm2.37868_at_rwcrnsc54>...
> > I have been successful returning a single value from a function, however
I
> > now need to return a record and am having difficulties. I want my
function
> > to be part of a package.
> >
> > I want the record to be a cursor record, because I only want to select
> > certain fields from a table, not the entire row.
> >
> > I can figure out what to put in as the return entry, when I don't
> > create the cursor record until after I define the cursor.
> >
> > Can anyone provide an example? I searched and I can't seem to
> > find one.
> >
> > Thanks.
> >
> > Tim
Received on Tue Feb 11 2003 - 14:30:06 CET

Original text of this message