各位大侠,请问,我现在遇到这样一个问题,在使用游标去fetch数据时,当数据量很小,以下语句可以成功执行,当批量上传,数据量非常大的时候,以下语句就会出错,报错是1002,请帮我看一下,问题在哪儿,谢谢。
EXEC SQL declare rtp_cur1 cursor for
                SELECT acct_name , acct_id , NVL( prov_name , chr( 0 ) ), NVL( area_name , chr( 0 ) ) ,
                is_same_city , acct_prop , sys_date , sys_seq_id , pay_amt , trans_stat ,
                bk_seq_no , NVL( gate_pri_data , chr( 0 ) ), mer_date, mer_id, ord_id,
                NVL( ret_url, ' ' ), NVL( mer_priv, ' ' )
                FROM PAY_LOG
                WHERE gate_id = :GateId and re_send_cnt < :FailResndCnt
                AND trans_stat = 'I'
                FOR UPDATE OF trans_stat , bk_seq_no ;
        if( sqlca.sqlcode != 0 )
        {
                ErrorLog( ERROR, "sqlca.sqlcode[%d][%s]" ,
                        sqlca.sqlcode, ( char* )sqlca.sqlerrm.sqlerrmc ) ;
                return -5 ;
        }        EXEC SQL open rtp_cur1 ;
        while( 1 )
        {
                for( i = 0; i <= 9; i++ )
                {
                        if( !strcmp( GateId, pay_gate_list[i].GateId ) )
                        {
                                ErrorLog( TRACE , "check gate[%d][%s][%.2lf][%.2lf]",
                                                i, pay_gate_list[i].GateId,
                                                pay_gate_list[i].WarnAmt,
                                                pay_gate_list[i].LowAmt ) ;                                if( BankBal < pay_gate_list[i].WarnAmt )
                                {
                                        ErrorLog( ERROR, "Bank Bal is too low to warning [%.2lf][%.2lf]",
                                                        BankBal, pay_gate_list[i].WarnAmt ) ;
                                        sprintf( buf , "银行账户余额低于警戒值[%.2lf],请财务部紧急处理",
                                                        pay_gate_list[i].WarnAmt ) ;
                                        snd_fnm( 'F' , "07" , "05" , "0002" , buf ) ;
                                }                                if( BankBal < pay_gate_list[i].LowAmt )
                                {
                                        ErrorLog( ERROR, "Bank Bal is too low to stop [%.2lf][%.2lf]",
                                                        BankBal, pay_gate_list[i].LowAmt ) ;
                                        sprintf( buf, "银行账户余额低于警戒值[%.2lf],交易已经暂停,请财务部紧急处理",
                                                        pay_gate_list[i].LowAmt ) ;
                                        snd_fnm( 'F' , "07" , "05" , "0003" , buf ) ;
                                        break ;
                                }                                nFlag = 1;
                        }
                }
if( !nFlag && i >= 9 )
                {
                        ErrorLog( ERROR, "gate_id[%s] invalid!", GateId );
                        sprintf( buf, "网关[%s]非法,请联系技术部", GateId ) ;
                        snd_fnm( 'F' , "07" , "05" , "0004" , buf ) ;
                        continue;
                }                EXEC SQL fetch rtp_cur1 into
                        :AcctName ,
                        :AcctId ,
                        :ProvName ,
                        :AreaName ,
                        :IsSameCity ,
                        :AcctProp ,
                        :SysDate ,
                        :SysSeqId ,
                        :PayAmt ,
                        :TransStat ,
                        :BkSeqNo ,
                        :GatePriData,
                        :MerDate,
                        :MerId,
                        :OrdId,
                        :RetUrl,
                        :MerPriv;
                if(sqlca.sqlcode == 1403 ) /* no record */
                {
                        break ;
                }
                else if(sqlca.sqlcode != 0 )
                {
                        ErrorLog( ERROR, "fetch err sqlca.sqlcode[%d][%s]" ,
                        sqlca.sqlcode, ( char* )sqlca.sqlerrm.sqlerrmc ) ;
                        continue ;
                }
请帮我看一下,指出问题,小弟感激不尽,谢谢。