工作代码示例:
declare
type a is table of number index by pls_integer;
b a;
begin
b(1) := 5;
end;
但是这样就不可能写了b(3000000000),因为 这个索引远超pls_integer,但是你需要使用超过 21 亿。你可以把它改成index by varchar2,但是这样会增加 30% 的查询执行时间。
index by number不起作用:
declare
type a is table of number index by number;
b a;
begin
b(1) := 5;
end;
错误报告 -
ORA-06550:第 2 行,第 13 列:
PLS-00315:实施限制:不支持的表索引类型
有没有办法使用大于 21 亿的数字索引?
数组中的元素并不多。
不,您不能超过限制
BINARY_INTEGER|PLS_INTEGER(-2147483648 到 2147483647)。推荐的解决方法是使用函数转换为
VARCHAR2TO_CHAR:这将是最有效的解决方案: