循环结构写的不对,正确如下:
open p_cursor FOR strsql;
         LOOP
           FETCH p_cursor INTO rsp_code,txcode,rejcode,standby2,aount;----关键,先fetch,后判断
           EXIT WHEN p_cursor%NOTFOUND;
           
              if rsp_code='00' then
                 if length(standby2)>36 then
                    tmp_min:=to_number(substr(standby2,11,7));--取第一个卡段后7位
                    tmp_max:=to_number(substr(standby2,30,7));--取第二个卡段后7位
                      rating:=rating+(tmp_max-tmp_min)+1;--计算卡段差值
                      HNT_sum_aount:=HNT_sum_aount+(tmp_max-tmp_min+1)*aount;--计算金额
                 end if;
              end if;
         END LOOP;
         CLOSE p_cursor;