//定義游標
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?
//將游標內(nèi)的數(shù)據(jù)一條條存放到數(shù)組里
?i += 1
?FETCH C1 INTO :record,:fare_sum;
?re_cd[i] = string(record)
?fr_sum[i] = string(fare_sum,"0.00")
LOOP
CLOSE C1;?