当前位置: 代码迷 >> PB >> 游标使用出错,该如何解决
  详细解决方案

游标使用出错,该如何解决

热度:119   发布时间:2016-04-29 09:11:37.0
游标使用出错
li_cs=1
declare lcur_yb cursor for
select MS_CF01.fphm from MS_CF01, MS_MZXX where MS_MZXX.BRID = MS_CF01.BRID and kfrq>= :ld_begin and kfrq<= :ld_end and ysdm=:ls_sle and fyck=1 and MS_MZXX.brxz=:ll_brxz and MS_MZXX.sjfp = MS_CF01.fphm and MS_MZXX.zfpb=0;
  open lcur_yb;
fetch lcur_yb into :ls_fphm
   
do while sqlca.sqlcode = 0  
  a=ls_fphm

  fetch lcur_yb into :ls_fphm
b=ls_fphm
if a <> b then
li_cs+=
end if 
  loop 
close lcur_yb;
dw_1.object.cfs[ll_row] = li_cs

------解决方案--------------------
C/C++ code
li_cs=1declare lcur_yb cursor forselect MS_CF01.fphm from MS_CF01, MS_MZXX where MS_MZXX.BRID = MS_CF01.BRID and kfrq>= :ld_begin and kfrq<= :ld_end and ysdm=:ls_sle and fyck=1 and MS_MZXX.brxz=:ll_brxz and MS_MZXX.sjfp = MS_CF01.fphm and MS_MZXX.zfpb=0;open lcur_yb;fetch lcur_yb into :ls_fphm;    do while sqlca.sqlcode = 0       a=ls_fphm    fetch lcur_yb into :ls_fphm;    b=ls_fphm    if a <> b then        li_cs += 1    end if  loop  close lcur_yb;dw_1.object.cfs[ll_row] = li_cs
------解决方案--------------------
fetch lcur_yb into :ls_fphm
后面要加分号
fetch lcur_yb into :ls_fphm;

li_cs+=
语法错误,应为
li_cs += 1
或者
li_cs ++

------解决方案--------------------
fetch lcur_yb into :ls_fphm 之后少了分号
------解决方案--------------------
三楼正解,遗漏两个分号和一个常量值
  相关解决方案