游标可以嵌套循环吗?
margg 2004-04-29 05:54:25 boolean lb_continue6,lb_6
declare cu_pcn6 cursor for
select id,p_cn from user_m where s_cn = :ls_pcn5;
open cu_pcn6;
Do while lb_continue6
Fetch cu_pcn6 into :li_userid6,:ls_pcn6;
if sqlca.sqlcode = 0 then
declare cu_assess6 cursor for
select assess from orderbill
where userid = :li_userid6
and year(makedate) = :li_year
and month(makedate) = :li_month ;
open cu_assess6;
Do while lb_6
Fetch cu_assess6 into :ld_assess6;
if sqlca.sqlcode = 0 then ld_total6 = ld_total6 + ld_assess6
else
lb_6 = false
end if
Loop
close cu_assess6;
else
lb_continue6 = false
end if
Loop
close cu_pcn6;