declare
type a1_array_type is varray(10) of int;
type a2_array_type is varray(20) of a1_array_type;
nv1 a2_array_type := a2_array_type(a1_array_type(58,100,102),
a1_array_type(55,6,73),a1_array_type(2,4));
begin
dbms_output.put_line('显示二维数组的所有元素');
for i in 1.. nv1.count loop
for j in 1.. nv1(i).count loop
dbms_output.put_line('('||i||','||j||')='||nv1(i)(j));
end loop;
end loop;
end;
declare
type a1_table_type is table of INT;
type na1_table_type is table of a1_table_type;
nv1 na1_table_type := na1_table_type(a1_table_type(2,5),a1_table_type(5,3,32));
begin
for i in 1 .. nv1.count loop
for j in 1 .. nv1(i).count loop
dbms_output.put_line('('||i||','||j||')='||nv1(i)(j));
end loop;
end loop;
end;
declare
type a1_array_type is table of int;
type a2_array_type is varray(20) of a1_array_type;
nv1 a2_array_type := a2_array_type(a1_array_type(58,100,102),
a1_array_type(55,6,73),a1_array_type(2,4));
begin
dbms_output.put_line('显示二维数组的所有元素');
for i in 1.. nv1.count loop
for j in 1.. nv1(i).count loop
dbms_output.put_line('('||i||','||j||')='||nv1(i)(j));
end loop;
end loop;
end;
declare
type a1_table_type is table of int index by binary_integer;
type na1_table_type is table of a1_table_type index by binary_integer;
nv1 na1_table_type;
begin
nv1(1)(1) := 1;
nv1(1)(2) := 2;
nv1(1)(3) := 3;
nv1(2)(1) := 4;
nv1(2)(2) := 5;
nv1(2)(3) := 6;
nv1(2)(4) := 7;
nv1(3)(1) := 8;
nv1(3)(2) := 9;
for i in 1 .. nv1.count loop
for j in 1 .. nv1(i).count loop
dbms_output.put_line('('||i||','||j||')='||nv1(i)(j));
end loop;
end loop;
end;
declare
type ename_table_type is varray(20) of varchar2(10);
ename_table ename_table_type;
begin
ename_table := ename_table_type('a','b');
ename_table.extend(5,2);
ename_table.trim(2);
for i in 1 .. ename_table.count loop
dbms_output.put_line(ename_table(i));
end loop;
end;