# 游标可以嵌套循环吗?

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;
...全文
54 4 点赞 打赏 收藏 举报

4 条回复

zysys 2004-04-30

DECLARE lcs_bat CURSOR FOR
select qut,ide_bat,dat_eff
from pro_bat_ide
where dep=:gl_dep and uqi_pro=:ll_uqi and qut>0;
OPEN lcs_bat;
FETCH lcs_bat INTO :ldc_qut,:ls_batide,:ldt_effdat;
DO WHILE sqlca.sqlcode=0
if MessageBox("发现该商品有“"+string(ll_CouRow)+"”个批号：","批号"+ls_batide+"数量为："+string(ldc_qut)+"有效期为："+string(ldt_EffDat,"yyyy.mm.dd")+"~r~n~r~n是否选择该批号的商品？",None!,YesNo!)=1 then
Exit
end if
FETCH lcs_bat INTO :ldc_qut,:ls_batide,:ldt_effdat;
LOOP
CLOSE lcs_bat;
• 打赏
• 举报

foxphoenix 2004-04-30

• 打赏
• 举报

10975037 2004-04-30

• 打赏
• 举报

hzhxxx 2004-04-29

• 打赏
• 举报

922

PowerBuilder 相关问题讨论

2004-04-29 05:54