我对批量收集SQL有点小问题,我希望您能帮助解决这个问题。
使用以下代码:
declare
cursor c1
is
select customer,product
from products;
type type_cust is table of products.customer%type;
type type_prod is table of products.product%type;
v_array_cust type_cust;
v_array_prod type_prod;
begin
open c1;
loop
fetch c1
into v_array_cust, v_array_prod
limit 1000;
exit when c1%notfound;
for i in 1..v_array_cust.count
loop
--Do some processing here.
end loop;
end loop;
end;
/
光标c1返回53166行。
但是,代码处理53000行,然后结束。似乎在检索最后166条记录时,会出现某种故障。
如果查找到的记录少于1000条,则提取将返回%NotFound吗?我应该把出口移到循环的末尾吗?(我将尝试这个方法,但这段代码需要3个小时才能到达故障点。)
事先谢谢。