带有pls\u整数的oracle集合
我已经在oracle中创建了包,并定义了如下类型带有pls\u整数的oracle集合,oracle,plsql,Oracle,Plsql,我已经在oracle中创建了包,并定义了如下类型 TYPE type_<xxx> IS TABLE OF <table>.value%TYPE INDEX BY pls_integer; 其中distinctNewValues,periods和curweekdayarray是类型 编译包时,它会在 distinctNewValues := pperiods MULTISET except curweekdayarray; 错误详细信息: 行。 错误:包体的编译错误。
TYPE type_<xxx> IS TABLE OF <table>.value%TYPE INDEX BY pls_integer;
其中distinctNewValues
,periods
和curweekdayarray
是类型
编译包时,它会在
distinctNewValues := pperiods MULTISET except curweekdayarray;
错误详细信息:
行。
错误:包体的编译错误。
错误:PLS-00306:调用“MULTISET\u除外”时参数的数量或类型错误
电话:163
Text:distinctNewValues:=除curweekdayarray之外的pperiods多集;
错误:PL/SQL:语句被忽略
电话:163
Text:distinctNewValues:=除curweekdayarray之外的pperiods多集;
我可以定义类型而不使用pls\u integer
索引。但是.NET
仅适用于它您面临的错误仅仅是因为多集
运算符希望将嵌套表视为其操作数,并且您具有关联数组。因此,为了能够使用multiset
操作符,您需要嵌套表
此匿名PL/SQL块将引发PLS-00306
错误:
declare
type t_list is table of number index by pls_integer; -- associative array
l_col1 t_list;
l_col2 t_list;
l_col_res t_list;
begin
l_col1(1) := 1;
l_col2(1) := 1;
l_col_res := l_col1 multiset except l_col2;
end;
PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
ORA-06550: line 9, column 3:
而这个不会(将关联数组更改为嵌套表):
我理解。然后,第二个问题出现了。如何将由pls_integer创建的类型转换为简单表类型?@AEMLoviji只需将pls_integer创建的索引
子句保留在外。在问题的最后,我写道,我可以定义没有pls_integer索引的类型。但是.NET只适用于it@AEMLoviji不幸的是,我对.NET不太熟悉,但首先,您肯定不能将multiset
运算符与关联数组一起使用,其次,尤其是在UDT和自定义对象类型之间的属性映射上。
line.
error:Compilation errors for PACKAGE BODY <schema>.<pkg_name>
Error: PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
Line: 163
Text: distinctNewValues := pperiods MULTISET except curweekdayarray;
Error: PL/SQL: Statement ignored
Line: 163
Text: distinctNewValues := pperiods MULTISET except curweekdayarray;
declare
type t_list is table of number index by pls_integer; -- associative array
l_col1 t_list;
l_col2 t_list;
l_col_res t_list;
begin
l_col1(1) := 1;
l_col2(1) := 1;
l_col_res := l_col1 multiset except l_col2;
end;
PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
ORA-06550: line 9, column 3:
declare
type t_list is table of number; -- nested table
l_col1 t_list := t_list(1,2,3);
l_col2 t_list := t_list(1,2);
l_col_res t_list;
begin
l_col_res := l_col1 multiset except l_col2;
end;
anonymous block completed