我正在尝试为varray编写一些聚合函数,当我尝试将它与数据库中的数据一起使用时,我得到了这个错误代码:
原文链接:https://www.f2er.com/oracle/205189.htmlORA-00600 internal error code,arguments: [kodpunp1],[],[] [koxsihread1],[0],[3989],[45778],[]
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,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;
接下来我创建一些测试数据:
create table t1_test_table( t1_id number not null,t1_value TEST_VECTOR not null,Constraint PRIMARY_KEY_1 PRIMARY KEY (t1_id) )
下一步是将一些数据放到表中
insert into t1_test_table (t1_id,t1_value) values (1,TEST_VECTOR('x','y','z'))
现在一切都准备好执行查询:
Select test_fn(TEST_VECTOR('y','x')) from dual
Select test_fn(t1_value) from t1_test_table where t1_id = 1
我使用的Oracle DBMS版本:11.2.0.3.0
有没有人试过做这样的事情?
为什么你认为它不起作用?