PB 游标语法

declare getstoragecard cursor for
        select to_char(needday,'yyyy-mm-dd'),sum(a.somany - a.storage - b.mademany)
                from mrp_detial a,v_new_tj_all_mrpmany b
                where a.mpsid=b.mpsid and
                        a.indexcode=b.mpsindex and
                        a.lifecode=6 and
                        a.needday>=sysdate  and
                        a.soncode=:productid 
                group by to_char(needday,'yyyy-mm-dd')
                ORDER BY to_char(needday,'yyyy-mm-dd');
open getstoragecard;
do while sqlca.sqlcode=0
        fetch getstoragecarD into :sday,:manyin;
        if sqlca.sqlcode=0 then
                i=dw_card.insertrow(0)
                dw_card.object.typein[i]='计划入库'
                dw_card.object.dayin[i]=sday
                dw_card.object.manyin[i]=manyin
        else
                exit
        end if
loop
close getstoragecard;

posted @ 2020-01-17 14:39  博客燕  阅读(528)  评论(0)    收藏  举报