PB中游标的使用 DECLARE CURSOR FETCH
扫描二维码
随时随地手机看文章
//定义游标
DECLARE C1 CURSOR FOR
//取值
select aln_cd,sum(cargo_aln_fare) from fare_daily_view
where aln_cd <> '000' and cargo_aln_fare <> 0 and act_fare_dt between :emstart and :emend
group by aln_cd;
//打开游标
OPEN C1;
DO WHILE sqlca.SQLCODE=0
//将游标内的数据一条条存放到数组里
i += 1
FETCH C1 INTO :record,:fare_sum;
re_cd[i] = string(record)
fr_sum[i] = string(fare_sum,"0.00")
LOOP
CLOSE C1;