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: How to use an associative array in (an object header)

Re: How to use an associative array in (an object header)

From: <jwheeler_at_assassincat.com>
Date: 9 Jun 2006 12:00:08 -0700
Message-ID: <1149879608.231658.294140@h76g2000cwa.googlegroups.com>


Sadly, RTFM isn't the answer in this case.

The ODCIAggregregate space is not the run of mill PL/SQL procedure.

My variable needs to be declared as part of the object header definition. For example, my code (which works around this issue for now) has an object header of:

CREATE OR REPLACE
TYPE srt7 as object
  (

       uniqueIDs     srt7_t,
       uniqueIDMax   NUMBER,
       dupeIDs      srt7_t,
       dupeIDMax     NUMBER,
       dupeSum     NUMBER,


       STATIC FUNCTION
          ODCIAggregateInitialize(sctx IN OUT srt7 )
            RETURN NUMBER,

       MEMBER FUNCTION
           ODCIAggregateIterate(self IN OUT srt7 ,
                                value IN NUMBER)
           RETURN NUMBER,

      MEMBER FUNCTION
           ODCIAggregateTerminate(self IN srt7,
                                  returnValue OUT  NUMBER,
                                  flags IN NUMBER)
           RETURN NUMBER,

      MEMBER FUNCTION
           ODCIAggregateMerge(self IN OUT srt7,
                              ctx2 IN srt7)
           RETURN NUMBER

 );

Notice that two of the variables are declared as type srt7_t - these are nested table types declared at the schema level. This works just fine. But, I can't declare srt7_t to be an associated array at the schema level (only varrays or nested tables) and I can't put the type definition within the object header.

Mladen Gogala wrote:
> jwheeler_at_assassincat.com wrote:
> >
> > While I've found a couple of different way to declare the array in the
> > type header, I can't figure out how to instantiate it in the
> > ODCIAggregateInitialize() function of the type body.
> >
> > I'd follow up on this question at Ask Tom, but the site doesn't seem to
> > be accepting new posts at the moment.
>
>
> No need to bother Tom with that. Put something like:
> "type mytype is table of EMP%ROWTYPE index by varchar2(10)" and
> declare a variable of that type. It's all right in the PL/SQL manual:
> http://tinyurl.com/hm7gw
> In other words, your question can be answered by the phrase "read the
> fine manual" or equivalent.
>
> --
> Mladen Gogala
> http://www.mgogala.com
Received on Fri Jun 09 2006 - 14:00:08 CDT

Original text of this message

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