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

Home -> Community -> Usenet -> c.d.o.server -> Re: Accessing components of an object within a varray...

Re: Accessing components of an object within a varray...

From: Ryan Gaffuri <rgaffuri_at_cox.net>
Date: 3 Sep 2003 12:16:40 -0700
Message-ID: <1efdad5b.0309031116.5aaad635@posting.google.com>


william_hulse_at_hotmail.com (will) wrote in message news:<283ad5ec.0309030612.40ec11fd_at_posting.google.com>...
> Hope you can help with the following...
>
> I have the following type declaration
>
> CREATE OR REPLACE TYPE mytype IS OBJECT (
> STATUS VARCHAR2(1000),
> SET_OF_BOOKS_ID NUMBER,
> ACCOUNTING_DATE DATE,
> CURRENCY_CODE VARCHAR2(1000),
> DATE_CREATED DATE,
> CREATED_BY NUMBER,
>
> );
>
> CREATE OR REPLACE TYPE mytype_Arr IS VARRAY(1000) OF mytype;
>
> What i need to know is how to assign values to specific components of
> the object within the varray ?
>
> For example set the status component of the 5th varray element to
> 'hello'
>
> I have tried the following
>
> mytype_Arr(i).status := 'hello';
>
> and have the following error..
>
> PLS-00363: expression 'mytype_Arr.status' cannot be used as an
> assignment target
>
> Any help ?
>
> Will

its explained otn in the developer guide on objects. writing to a VARRAY is similiar to writing to an object. Best explanation I have seen is in Fuerstein's PL/SQL guide. Also check asktom.oracle.com, probably have an example there.

you dont initialize. you use insert. Its something like this

insert into table
values
(col1,col2,type('a','b','c'));

type represents your 'cast'. its something like that. im sure the syntax is off a little bit. Received on Wed Sep 03 2003 - 14:16:40 CDT

Original text of this message

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