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: how to use an object in a select statement?

Re: how to use an object in a select statement?

From: Daniel Morgan <damorgan_at_exxesolutions.com>
Date: Fri, 25 Jul 2003 09:45:36 -0700
Message-ID: <3F215EB0.D5A1ACBE@exxesolutions.com>


André Rothe wrote:

> Hi,
>
> I wrote a function in package which returns an object like
> the following:
>
> create or replace type as object (
> id number,
> test number,
> adate date
> );
>
> The function works very well, but I cannot use the
> return value in a select statement.
>
> I tried:
>
> select pa.func().id from dual;
>
> But it doesn't work. How can I write a select statement,
> which use the attributes of the object?
> Can I use the return values without a temporary table
> in which I have to copy the values?
>
> Thank you
> Andre

CREATE TYPE ProjectList AS VARRAY(50) OF Project; /

CREATE TABLE department (
dept_id NUMBER(2),
name VARCHAR2(15),
budget NUMBER(11,2),
projects ProjectList);

INSERT INTO department

VALUES(30, 'Accounting', 1205700,ProjectList (
Project(1, 'Design New Expense Report',3250),
Project(2, 'Outsource Payroll', 12350),
Project(3, 'Evaluate Merger Proposal', 2750),
Project(4, 'Audit Accounts Payable', 1425)));

Correct syntax generally works.

--
Daniel Morgan
http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Fri Jul 25 2003 - 11:45:36 CDT

Original text of this message

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