游标

//游标
DECLARE hhh CURSOR FOR
select sum(b.bill_money) ,b.org_id
from tb_ax006 b
where b.bill_date between to_date(:ls_dt_str,'yyyy-mm-dd') and to_date(:ls_dt_end,'yyyy-mm-dd')+0.99999
group by b.org_id;

//messagebox("提示",sqlca.sqlcode)
open hhh;//打开数据集合

do while sqlca.sqlcode = 0 //循环遍历
fetch hhh into :ls_org_bill,:ls_org_id;
if sqlca.sqlcode = 0 then //此处又增加的判断(防止多循环一次)
uo_1.of_additem(ls_org_bill);
end if
loop
close hhh;

 

 

PB中生产步骤:

1.点击paste sql图标,选择cursor declare

posted on 2015-01-27 17:29  博客园Jason  阅读(123)  评论(0编辑  收藏  举报

导航