declare
cursor get_xmm01_cur(in_batch_id number, in_org_id number) is
select xmm_01.*
from MG_MFG_39_GT_01_LD xmm_01
where xmm_01.batch_id = in_batch_id
and xmm_01.org_id = in_org_id
and xmm_01.process_code is null
for update nowait;
cursor get_xmm02_cur(in_header_ridx number) is
select xmm_02.*
from MG_MFG_39_GT_02_LD xmm_02
where xmm_02.header_ridx = in_header_ridx
for update nowait;
Type xmm02_tbl Is Table Of MG_MFG_39_GT_02_LD%rowtype Index By Binary_Integer;
type xmm_rtype is record(
xmm01_rtype get_xmm01_cur%rowtype,
xmm02_rtype xmm02_tbl);
Type xmm_rec Is Table Of xmm_rtype Index By Binary_Integer;
ln_cnt number := 1;
in_bom_tbl xmm_rec;
n number;
begin
open get_xmm01_cur(1, 207);
loop
fetch get_xmm01_cur
into in_bom_tbl(ln_cnt).xmm01_rtype;
dbms_output.put_line(': ' ||get_xmm01_cur%rowcount);
exit when get_xmm01_cur%NOTFOUND;
open get_xmm02_cur(in_bom_tbl(ln_cnt).xmm01_rtype.header_ridx);
fetch get_xmm02_cur bulk collect
into in_bom_tbl(ln_cnt).xmm02_rtype;
dbms_output.put_line('2--' ||in_bom_tbl(ln_cnt).xmm02_rtype.count);
close get_xmm02_cur;
if in_bom_tbl(ln_cnt).xmm02_rtype.count = 0 then
dbms_output.put_line(': ' ||
'there is no record to be processed in line!');
end if;
ln_cnt := ln_cnt + 1;
end loop;
if get_xmm01_cur%rowcount = 0 then
dbms_output.put_line(': ' ||
'there is no record to be processed in head!');
end if;
close get_xmm01_cur;
end;
处理复合变量的游标操作
最新推荐文章于 2025-02-07 14:36:37 发布