Plsql 在pl sql中的二维数组中插入值

Plsql 在pl sql中的二维数组中插入值,plsql,Plsql,我是新手,正在努力学习pl sql编程 如何使用plsql程序在2D数组中插入数据。我能够在一维数组中插入数据,但在二维数组中插入数据时遇到了问题 declare type type1 is table of number; type data_type is table of type1; y data_type; begin y := data_type(); y.extend(20000); for i in 1..100 loop for j in 1..

我是新手,正在努力学习pl sql编程

如何使用plsql程序在2D数组中插入数据。我能够在一维数组中插入数据,但在二维数组中插入数据时遇到了问题

declare
  type type1 is table of number;
  type data_type is table of type1;
  y data_type;
begin
  y := data_type();
  y.extend(20000);
  for i in 1..100 loop
    for j in 1..100 loop
      y(i)(j) := i+j; 
    end loop;
  end loop;
end;

任何信息或提示都会有帮助。

您可以初始化和扩展外部数组
y
,但您还需要初始化和扩展每个子数组
y(i)

以上代码在我的Oracle XE 11gR2数据库上成功运行

declare
  type type1 is table of number;
  type data_type is table of type1;
  y data_type;
begin
  y := data_type();
  y.extend(100);
  for i in 1..100 loop
    y(i) := type1();
    y(i).extend(100);
    for j in 1..100 loop
      y(i)(j) := i+j; 
    end loop;
  end loop;
end;
/