我现在在存储过程中使用游标取出几万条记录集,然后打开游标,对每条记录作处理,
平均每条记录要处理1秒钟,这样导致报错ora-01555 snapshot too old,我现在想通过把记录集取到一个变量集合里,然后对变量集合的每个记录作处理,
但不知道这个变量集合怎么定义,怎么取数据,请高手指教!
平均每条记录要处理1秒钟,这样导致报错ora-01555 snapshot too old,我现在想通过把记录集取到一个变量集合里,然后对变量集合的每个记录作处理,
但不知道这个变量集合怎么定义,怎么取数据,请高手指教!
index by binary_integercollect collect_type;
查询的时候就
select * bulk collect into collect from XXX然后对集合collect操作咯
for i in 1..collect1.count loop
这时候collect1就相当一个2维数组了
collect1(i).字段名 这样调用
做你要的操作咯
end loop;
a table.a%TYPE
)
type t_t is table of t_rec index by binary_integer;
l_t t_t;
SQL_AREA:='select a from table';
execute immediate SQL_AREA
bulk collect into l_t;for i in 1..l_t.count loop
取得l_t[i].a;
end loop;貌似用动态的sql能快一些