表类型变量在循环中添加值

时间:2016-12-07 07:16:05

标签: oracle loops types

我创建了表格类型

 create or replace TYPE NUMBER_ARRAY 
    AS TABLE OF NUMBER;

我希望PERIODS变量在循环中添加值

DECLARE PERIODS NUMBER_ARRAY;
BEGIN
FOR I IN 1..10
LOOP
--I add to periods
END LOOP;
END;

1 个答案:

答案 0 :(得分:0)

你看起来像

DECLARE 
  PERIODS NUMBER_ARRAY := NUMBER_ARRAY();
BEGIN
  FOR I IN 1..10 LOOP
    periods.extend;
    periods(i) := i * 2;
  END LOOP;
END;