gpt4 book ai didi

sql - Oracle 批量收集问题

转载 作者:行者123 更新时间:2023-12-04 13:42:18 24 4
gpt4 key购买 nike

我在处理批量收集 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 条记录,fetch 是否会返回 %notfound?我应该将导出移到循环的末尾吗? (我打算尝试这个,但它在一段代码中很深,需要 3 个小时才能到达故障点。)

提前致谢。

最佳答案

好吧,比我已经做的更好的谷歌搜索给了我你不应该使用 %notfound with limit 的答案。

检查 here寻求解释。

关于sql - Oracle 批量收集问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3865295/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com