分析:
首先要存在一个数组类型,然后才能去定义数组变量,所以编写PL/SQL如下:
declare
--定义一个数组类型
type a_type is table of number;
a a_type := a_type();
begin
a.extend(3);
a(1) := 1;
a(2) := 2;
a(3) := 3;
for cou in 1 .. a.count loop
dbms_output.put_line(a(cou));
end loop;
end;
其他方法和属性:
first -- 第一个元素下标 last -- 最后一个元素下标 count -- 数组元素个数 prior(n) -- 下标 n 的前一个元素下标 next(n) -- 下标 n 后一个元素下标 extend(n) -- 添加 n 个数组元素,不带参数添加一个数组元素 delete(n) -- 删除数组中下标为 n 的元素,不带参数删除整个数组元素