PL/SQL VARRAY 的最大尺寸
PL/SQL maximum size of VARRAY
我正在尝试计算 PL/SQL 中 VARRAY 的可能 上限 。
我们当然可以定义VARRAY类型为
TYPE type_name IS {VARRAY | VARYING ARRAY} (size_limit)
OF element_type [NOT NULL];
Oracle 文档是这样说的:
Each varray is stored as a single object, either inside the table of
which it is a column (if the varray is less than 4KB) or outside the
table but still in the same tablespace (if the varray is greater than
4KB). You must update or retrieve all elements of the varray at the
same time, which is most appropriate when performing some operation on
all the elements at once. But you might find it impractical to store
and retrieve large numbers of elements this way.
但是size_limit
参数的上限是多少?它是否等于无符号整数 (4,294,967,295)?
在 PL/SQL 内,限制为 2147483647。相同的限制适用于架构不同的数组类型。
DECLARE
TYPE t IS VARRAY(2147483647) OF NUMBER;
BEGIN
NULL;
END;
如果你增加它,它会抛出 PLS-00325: non-integral numeric literal 2147483648 is inappropriate in this context
。
我正在尝试计算 PL/SQL 中 VARRAY 的可能 上限 。
我们当然可以定义VARRAY类型为
TYPE type_name IS {VARRAY | VARYING ARRAY} (size_limit)
OF element_type [NOT NULL];
Oracle 文档是这样说的:
Each varray is stored as a single object, either inside the table of which it is a column (if the varray is less than 4KB) or outside the table but still in the same tablespace (if the varray is greater than 4KB). You must update or retrieve all elements of the varray at the same time, which is most appropriate when performing some operation on all the elements at once. But you might find it impractical to store and retrieve large numbers of elements this way.
但是size_limit
参数的上限是多少?它是否等于无符号整数 (4,294,967,295)?
在 PL/SQL 内,限制为 2147483647。相同的限制适用于架构不同的数组类型。
DECLARE
TYPE t IS VARRAY(2147483647) OF NUMBER;
BEGIN
NULL;
END;
如果你增加它,它会抛出 PLS-00325: non-integral numeric literal 2147483648 is inappropriate in this context
。