title: Oracle User defined aggregate function for varray of varchar
body: <p>I am trying to write some aggregate function for the varray and I get this error code when I'm trying to use it with data from the DB:</p>
  
  <pre><code>ORA-00600 internal error code, arguments: [kodpunp1], [], [], [], [], [], [], [], [], [], [], []
  [koxsihread1], [0], [3989], [45778], [], [], [], [], [], [], [], []
  </code></pre>
  
  <p>Code of the function is really simple (in fact it does nothing):</p>
  
  <pre><code>create or replace
  TYPE "TEST_VECTOR" as varray(10) of varchar(20)
   ALTER TYPE "TEST_VECTOR" MODIFY LIMIT 4000 CASCADE
  
  
  create or replace
  type Test as object(
    lastVector TEST_VECTOR,
  
    STATIC FUNCTION ODCIAggregateInitialize(sctx in out Test) return number,
  MEMBER FUNCTION ODCIAggregateIterate(self in out Test, value in TEST_VECTOR) return number,
  MEMBER FUNCTION ODCIAggregateMerge(self IN OUT Test, ctx2 IN Test) return number,
  MEMBER FUNCTION ODCIAggregateTerminate(self IN Test, returnValue OUT TEST_VECTOR, flags IN number) return number
  );
  
  create or replace
  type body Test is
    STATIC FUNCTION ODCIAggregateInitialize(sctx in out Test) return number is
    begin
      sctx := Test(TEST_VECTOR());
      return ODCIConst.Success;
    end;
  MEMBER FUNCTION ODCIAggregateIterate(self in out Test, value in TEST_VECTOR) return number  is
  begin
    self.lastVector := value;
    return ODCIConst.Success;
  end;
  MEMBER FUNCTION ODCIAggregateMerge(self IN OUT Test, ctx2 IN Test) return number is 
  begin
   return ODCIConst.Success;
  end;
  MEMBER FUNCTION ODCIAggregateTerminate(self IN Test, returnValue OUT TEST_VECTOR, flags IN number) return number is
  begin
    returnValue := self.lastVector;
   return ODCIConst.Success;
  end;
  end;
  
  create or replace
  FUNCTION test_fn (input TEST_VECTOR) RETURN TEST_VECTOR 
  PARALLEL_ENABLE AGGREGATE USING Test;
  </code></pre>
  
  <p>Next I create some test data:</p>
  
  <pre><code>create table t1_test_table(
    t1_id number not null,
    t1_value TEST_VECTOR not null,
    Constraint PRIMARY_KEY_1 PRIMARY KEY (t1_id)
  )
  </code></pre>
  
  <p>Next step is to put some data to the table</p>
  
  <pre><code>insert into t1_test_table (t1_id,t1_value) values (1,TEST_VECTOR('x','y','z'))
  </code></pre>
  
  <p>Now everything is prepared to perform queries:</p>
  
  <pre><code>Select test_fn(TEST_VECTOR('y','x')) from dual
  </code></pre>
  
  <p>Query above work well</p>
  
  <pre><code>Select test_fn(t1_value) from t1_test_table where t1_id = 1
  </code></pre>
  
  <p>Version of Oracle DBMS I use: 11.2.0.3.0</p>
  
  <p>Has anyone tried do such a thing?
  Why do you think it's not working?</p>