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

From: web guy <web-guy01_at_attbi.com>
Date: Tue, 11 Feb 2003 21:36:47 GMT
Message-ID: <P1e2a.76295$be.55500_at_rwcrnsc53>


I was "hanging on" to the function method because it seemed (to me) to be cleaner if you only had to make a record, not a record and a ref cursor. Plus it
should have worked, so I wanted to find out what I was doing incorrectly so I
could learn something.

I did get the function to return a record, but now I can't figure out what to do with
it! Would I have the same situation if I returned a ref cursor?

I call the function from a form, now how can I store the record in a variable in the form?
I'm trying to do one call to the database to receive the record to the form, then set other
items in the form with the data in the record.

Thanks.
"DA Morgan" <damorgan_at_exesolutions.com> wrote in message news:3E49273B.C1EDAD19_at_exesolutions.com...
> web guy wrote:
>
> > It is close. I "think" I want to use a function instead of a procedure,
> > but does it matter? I'm going by what I've read, to use a function to
> > return something to an Oracle Form.
> >
> > If I create the type Record in the package header, what do I
> > use as the RETURN entry for the function in the package body?
> >
> > thx
> >
> > "P Ethiraj" <pethiraj_at_hotmail.com> wrote in message
> > news:b29t1c$25b$1_at_admin-svc.micron.com...
> > > Are you looking for something like this ....
> > >
> > > CREATE OR REPLACE PACKAGE "MYCPUCUR" AS
> > > TYPE aRecTyp IS RECORD (
> > > datetime date,
> > > valueavg float
> > > );
> > > TYPE aCurTyp IS REF CURSOR RETURN aRecTyp;
> > > END;
> > >
> > > CREATE OR REPLACE PROCEDURE "GET_CPU" (
> > > cv OUT MYCPUCUR.aCurTyp
> > > )
> > > AS
> > > BEGIN
> > > OPEN cv FOR
> > > SELECT
> > > LocalTimestamp AS TimeStamp
> > > ValueAvg As ValueAvg
> > > FROM
> > > MeasurementSummary ms;
> > > END;
> > >
> > > - Ethiraj
> > > "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
> > > >
> > > >
> > >
> > >
>
> If there is no difference why are you hanging onto a particular way of
doing it?
>
> Cross-posting to c.d.oracle dropped.
>
> Daniel Morgan
>
Received on Tue Feb 11 2003 - 22:36:47 CET

Original text of this message