PL/SQL VARRAY 的最大大小

PL/SQL maximum size of VARRAY(PL/SQL VARRAY 的最大大小)
本文介绍了PL/SQL VARRAY 的最大大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找出 PL/SQL 中 VARRAY 可能的上限.

I'm trying to figure out the possible upper bound of VARRAY in PL/SQL.

我们肯定可以将 VARRAY 类型定义为

We sure can define VARRAY type as

TYPE type_name IS {VARRAY | VARYING ARRAY} (size_limit) 
   OF element_type [NOT NULL];

Oracle 文档是这样说的:

Oracle documentation has this to say:

每个 Varray 都存储为单个对象,或者在表中它是一列(如果 varray 小于 4KB)或在列之外表但仍在同一个表空间中(如果 varray 大于4KB).您必须在以下位置更新或检索 varray 的所有元素同时,这在执行某些操作时最合适一次完成所有元素.但是您可能会发现存储不切实际并以这种方式检索大量元素.

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)?

But what is the upper bound of size_limit parameter? Is it equal to unsigned integer (4,294,967,295)?

推荐答案

在 PL/SQL 中,限制为 2147483647.同样的限制适用于架构变化的数组类型.

Within PL/SQL the limit is 2147483647. The same limit applies to schema varying array types.

DECLARE
    TYPE t IS VARRAY(2147483647) OF NUMBER;
BEGIN
    NULL;
END;

如果你增加它,它会抛出 PLS-00325: non-integral numeric literal 2147483648 在这种情况下是不合适的.

If you increase it it throws PLS-00325: non-integral numeric literal 2147483648 is inappropriate in this context.

这篇关于PL/SQL VARRAY 的最大大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)