Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Use function in SELECT with array/record as return value?

Re: Use function in SELECT with array/record as return value?

From: Martin Chadderton <martin.chadderton_at_mwhglobal.com>
Date: 8 Apr 2003 03:45:03 -0700
Message-ID: <3aaef271.0304080245.3235124a@posting.google.com>


Timo Neumann <t.neumann_at_ff-muenchen.de> wrote in message news:<vGhka.3112$506.3841_at_typhoon.bart.nl>...
> Hi all,
>
> I would like to use a function to return more than one value per call. I
> understand that I can use varrays, PL/SQL tables, or records.
> My problem is, that I need to call the function from a SQL SELECT statement.
>
> Here is an example: I've got this tables:
>
> tbPerson ( personid, lastname, firstname );
> tbAddress( addressid, personid, street, zip, town, addresstype );
>
> As you can see one person can have multiple addresses.
>
> I want the following view:
>
> vwPersonAddress( personid, name, street, zip, town )
>
> I would like to fetch street, zip, and town with a function.
> Sth. like:
>
> SELECT p.personid, p.name,
> PKG.getAddress( a.addressid, 'Home' )
> FROM tbPerson p, tbAddress a
>
> Is this possible? Or can I use only "primitive" datatypes as return
> values if calling from DQL?
>
>
> Thanks for your help,
>
> Timo

Hi,

as long as your function returns a SQL collection type (nested table / varray), then you can use the TABLE(<function>) operator and select from it directly, i.e. SELECT * FROM TABLE(<function>) Received on Tue Apr 08 2003 - 05:45:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US