Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Accessing components of an object within a varray...
"will" <william_hulse_at_hotmail.com> wrote in message news:283ad5ec.0309090608.301c0ca8_at_posting.google.com...
> > >
> > > 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 ?
when you are assigning values to an object, you have to use the object's default constructor. Which is the type name (by default). So, if you have:
zot TYPE mytype := <something>;,
the <something> has to be:
mytype(<value_of_STATUS>,<value_of_SET_OF_BOOKS_ID>,etcetc).
If then you have an array and you want to initialize one element of the array like in:
> AP_GL_ITEM(i).ACCOUNTING_DATE := ac_date;
you'll need to initialize ALL aattributes of the array element object type using the type name as the constructor. In the case above, something like: AP_GL_ITEM(i).<type_name>(attr1 := value_1,attr2:= value_2,etc...);
> any more clues.. ?
HTH
-- Cheers Nuno Souto wizofoz2k_at_yahoo.com.au.nospamReceived on Wed Sep 10 2003 - 07:41:56 CDT