定义好的光标可以改变其内容再使用吗?
create or replace procedure GL_loss_profit_company
(
v_CompId varchar2
)
as
v_tmp varchar2(20);
v_ProfitVoucher varchar2(20);
cursor tmp_cursor
is
select fja06c
from fjm01
where fja00c = v_CompId ;
begin
open tmp_cursor;
fetch tmp_cursor into v_tmp;
while (tmp_cursor%found) loop
v_ProfitVoucher := v_tmp;
-- 此处省略N行
fetch tmp_cursor into v_tmp;
END loop;
close tmp_cursor;
-- 问题就出在这儿,如何将tmp_cursor这个光标重新定义使用呢?
cursor tmp_cursor
is
select fia06c
from fim01
where fia00c = v_CompId ;
open tmp_cursor;
fetch tmp_cursor into v_tmp;
while (tmp_cursor%found) loop
v_ProfitVoucher := v_tmp;
-- 此处省略N行
fetch tmp_cursor into v_tmp;
END loop;
close tmp_cursor;
end GL_loss_profit_company;
还有一问: 定义好的光标如何将其杀掉呢?