我正在写一个函数,需要同时处理多个行,并且他们需要进行索引。经过几个小时的阅读关于Oracle pl/sql,我想我可以创建一个嵌套表类型的集合。由于我找不到明确的答案,并且试验/错误方法需要长时间。 这是问题部分: 问题:填充嵌套表集合的最佳实践是什么?甲骨文的PL/SQL如何使用游标插入到嵌套表集合plsql
type partsTable is table of Parts_north_wing%rowtype;
pt PartsTable;
index number;
cursor pCursor is select * from Parts_north_wing;
begin
index := 1;
open pCursor;
loop
fetch pCursor into tempRow;
pt(index) := tempRow;
index := index + 1;
exit when pCursor%notfound;
end loop;
close pCursor;
我相信,最有效的方法是在你的光标上使用'BULK COLLECT INTO'子句或者选择,例如, OPEN pCursor; FETCH pCursor BULK COLLECT INTO pt;关闭pCursor;'。 – AndrewMcCoist