免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2642 | 回复: 0
打印 上一主题 下一主题

Informix滚动游标 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-02-24 10:07 |只看该作者 |倒序浏览
function chek_jxhs()

define v_bdbxqq like fl_abc:fl_tbd.bdbxqq   #保单起始日期
define v_bdh like fl_dwjzjs.bdh             #保单号
define v_jsrq like fl_dwjzjs.jsrq           #结息日期


define a_bdh char(17)                       #第一行
define a_jsrq date                          #第一行

define b_bdh char(17)                       #第二行
define b_jsrq date                          #第二行

define v_ts int                             #减出的月差
define v_yf int                             #月份
define i int            
define v_rq char(17)
define v_rqq char(17)
define v_rqqq char(17)


declare  cur_jxhs cursor for

select a.bdh,a.jsrq
from fl_dwjzjs a,fl_tbd b
where a.bdh[8,10]='720'
and a.bdh=b.bdh
and (a.dwlxlj4-a.dwlxlj)<>0
and a.jsrq>=b.bdbxqq
and a.jsrq<=today
and b.bdzt[1]='1'
group by a.bdh,a.jsrq
order by a.bdh,a.jsrq;
  

open cur_jxhs
let i=1
FETCH FIRST cur_jxhs INTO a_bdh,a_jsrq
while  a_bdh is not null and a_jsrq is not null
                   FETCH NEXT cur_jxhs INTO b_bdh,b_jsrq
                if  a_bdh==b_bdh and year(a_jsrq)==year(b_jsrq) and month(b_jsrq)-month(a_jsrq)<>0 then
                             let v_ts = month(b_jsrq)-month(a_jsrq)
                             while  i<= v_ts
                             let v_yf = month(b_jsrq)-1
                             
                             let v_rq =year(b_jsrq)
                             let v_rqq = v_yf
                             let v_rqqq=v_rq  CLIPPED, v_rqq
                             
                            insert into fl_abc:err_zl
                            values('720',b_bdh,'','fl_dwjzjs','dwlxlj4','2','每月结息错误','在单位账户计算表中fl_dwjzjs没有结息的月份',v_rqqq,today);
         
                                    exit while
end while
                  end if
            let a_bdh=b_bdh
            let a_jsrq=b_jsrq
         exit while
end while
       
close cur_jxhs
FREE cur_jxhs

end function

SQL statement error number -482.
Invalid operation on a non-SCROLL cursor.  让我创建一个滚动游标,FETCH FIRST cur_jxhs INTO a_bdh,a_jsrq 在这里就运行就会报错
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP