8

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:

ORA-00600 internal error code, arguments: [kodpunp1], [], [], [], [], [], [], [], [], [], [], []
[koxsihread1], [0], [3989], [45778], [], [], [], [], [], [], [], []

Code of the function is really simple (in fact it does nothing):

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;

Next I create some test data:

create table t1_test_table(
  t1_id number not null,
  t1_value TEST_VECTOR not null,
  Constraint PRIMARY_KEY_1 PRIMARY KEY (t1_id)
)

Next step is to put some data to the table

insert into t1_test_table (t1_id,t1_value) values (1,TEST_VECTOR('x','y','z'))

Now everything is prepared to perform queries:

Select test_fn(TEST_VECTOR('y','x')) from dual

Query above work well

Select test_fn(t1_value) from t1_test_table where t1_id = 1

Version of Oracle DBMS I use: 11.2.0.3.0

Has anyone tried do such a thing? Why do you think it's not working?

Cœur
  • 37,241
  • 25
  • 195
  • 267
baju
  • 511
  • 5
  • 19
  • 4
    ORA-600 -> go to Oracle support and look for bug fixes. If you find none, file a support request. – Mat Sep 02 '12 at 15:41
  • 3
    There's no need to re-invent the wheel. In 11.2 you have [listagg](http://docs.oracle.com/cd/E14072_01/server.112/e10592/functions087.htm) and if you really want a user defined one copy and paste [Tom Kyte's stragg](http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:2196162600402). – Ben Sep 02 '12 at 16:23
  • @Ben In fact I do not want to get all results from group. I' m interested in only one specific result(in fact the newest one, sorted by one column) .It can be done thanks to the 'First' function for example: Select column_name_2 aggregate_function(column_name) KEEP (DENSE_RANK LAST ORDER BY x) FROM W group by column_name_2. It can be done also in other way but this I think is quite good. – baju Sep 02 '12 at 17:21
  • 2
    This will work if you change the varray to a nested table. Although I'm not sure if that's a suitable work-around. Do you really need the 4000 limit? – Jon Heller Oct 02 '12 at 06:53
  • @jonearles More or less I need 4000 limit as it stores data from the experiment. What is more datatypes were definied and should not be changed(also nested tables do not guarantee order of the elements). Converting between nested table and varray is not good idea as it influence on the performance. – baju Oct 03 '12 at 10:54
  • 4
    The user posted the same mangled question in the OTN forum, where they got some helpful advice. Whether they took it or not is a different matter. https://forums.oracle.com/forums/thread.jspa?messageID=10552842 – APC Nov 15 '12 at 07:34

2 Answers2

1

As has been noted, ORA-00600 is an internal Oracle bug. There is no rhyme or reason to them and the only true fix is to get a patch from Oracle.

However... that all said... it is often possible to tweak your code a bit to avoid the bug.

In your case, you can do this:

Select test_fn(cast(t1_value as test_vector)) 
from t1_test_table 
where t1_id = 1;

That is, explicitly cast the column as test_vector before passing it in to your ODCI aggregate.

This works in 12c, anyway. (And, in 12c, you'll get the ORA-00600 without this fix, too).

Matthew McPeak
  • 17,705
  • 2
  • 27
  • 59
-5

"ORA-00600 internal error code, arguments:", It indicates some blocks are corrupted internally try to recovery the system tablespace and particular user tablespace.

  • 7
    -1 This answer will not help solve this problem and is bad advice in general. The problem can be reproduced with the provided sample data, there are no corrupted blocks. ORA-00600 just means an Oracle bug, it does not necessarily mean anything is wrong with the data. – Jon Heller Sep 16 '13 at 18:06
  • 2
    ORA-00600 is Oracle's generic code for unhandled internal exceptions, i.e. bugs. Corrupted blocks are one possible source of ORA-00600 errors, but there are many many others. The arguments indicate the specific cause. The advised action is to call Oracle Support, because the solution may require a patch. – APC Dec 26 '15 at 10:51