【发布时间】:2011-10-22 11:23:51
【问题描述】:
declare
type yy is table of t12.name%type;
y yy:=yy();
n number:=1;
begin
y.extend(10);
select name bulk collect into y from t12;
--select name into y(5) from t12 where id=1; If i uncomment this line it gives error
for i in (select name from t12)
loop
dbms_output.put_line(y(n));
n:=n+1;
end loop;
end;
【问题讨论】:
-
表 t12 中只有 4 行我使用 y.extend(10) 分配了 10 个块。为什么我无法访问 y(5)
-
注释
select name bulk collect行并取消注释当前注释的行...错误应该消失了... -
are nooooooooo....这就是问题所在..我知道它会起作用...但问题是...批量收集..我的嵌套表在做什么。 .为什么我不能在使用批量收集后向此表添加更多元素...
-
您可以添加更多元素...您尝试访问索引 5 处的元素,而无需首先检查该元素是否存在...
builk collect替换了您的嵌套表 - 它创建了一个新表. -
现在这就是我所谓的概念构建...我也这么想..但我没有信心..但现在..一切都很清楚..tnx反正....
标签: oracle plsql oracle10g oracle11g plsqldeveloper