MyException - 我的异常网
当前位置:我的异常网» PB » PowerBuilder中在调用oracle存储过程时,怎么使用绑

PowerBuilder中在调用oracle存储过程时,怎么使用绑定变量

www.myexceptions.net  网友分享于:2013-03-27  浏览:92次
PowerBuilder中在调用oracle存储过程时,如何使用绑定变量?
在oracle的SQL追踪中发现大量如下记录:
SQL code
 
BEGIN        TheCompChargeVerify( ParmComp => '15049910024408' , ParmNeedPayNo => '200909041141
41' , ParmCycle => '199805' , ParmInsure => '020101' , ParmFlag => '0' , ParmOperator => 'sa2' 
,RETERRTEXT=>:RETERRTEXT,RETERR=>:RETERR); END; 
/
BEGIN        TheCompChargeVerify( ParmComp => '15049910024408' , ParmNeedPayNo => '200909041141
41' , ParmCycle => '199805' , ParmInsure => '020301' , ParmFlag => '0' , ParmOperator => 'sa2' 
,RETERRTEXT=>:RETERRTEXT,RETERR=>:RETERR); END; 
/
BEGIN        TheCompChargeVerify( ParmComp => '15049910024408' , ParmNeedPayNo => '200909041141
41' , ParmCycle => '199806' , ParmInsure => '020101' , ParmFlag => '0' , ParmOperator => 'sa2' 
,RETERRTEXT=>:RETERRTEXT,RETERR=>:RETERR); END; 
/
BEGIN        TheCompChargeVerify( ParmComp => '15049910024408' , ParmNeedPayNo => '200909041141
41' , ParmCycle => '199806' , ParmInsure => '020301' , ParmFlag => '0' , ParmOperator => 'sa2' 
,RETERRTEXT=>:RETERRTEXT,RETERR=>:RETERR); END; 
/
BEGIN        TheCompChargeVerify( ParmComp => '15049910024408' , ParmNeedPayNo => '200909041141
41' , ParmCycle => '199807' , ParmInsure => '020101' , ParmFlag => '0' , ParmOperator => 'sa2' 
,RETERRTEXT=>:RETERRTEXT,RETERR=>:RETERR); END; 
/
......

根据这个记录,我估计是开发人员绑定变量使用的有问题,导致出现大量此类记录
这段代码是通过PB调用的
我对PB一点都不懂,PB开发人员给的调用代码如下:
SQL code

string Ls_RetErrText,ls_ID,ls_aka_append,ls_AAE140,ls_AAE002
int Li_RetErr 
long ll_rows,ll_row
 
DECLARE TheCompChargeVerifyePro PROCEDURE FOR TheCompChargeVerify 
            ( ParmComp      => :parmcomp,
          ParmNeedPayNo => :ls_ID,
          ParmCycle     => :ls_AAE002,
          ParmInsure    => :ls_AAE140,
          ParmFlag      => :ls_aka_append,
          ParmOperator  => :ThisCurrEmpPurData.oper_name
         )  
      USING SQLCA;         
 
for ll_row = 1 to ll_rows
     if dw_n.getitemnumber(ll_row,'flag') = 1 then
         ls_ID         = dw_n.getitemstring(ll_row,'ID')
         ls_aka_append = dw_n.getitemstring(ll_row,'aka_append')
         ls_AAE140     = dw_n.getitemstring(ll_row,'AAE140')
         ls_AAE002     = dw_n.getitemstring(ll_row,'AAE002')
         
         EXECUTE TheCompChargeVerifyePro;
        
         if sqlca.sqlcode < 0 then
             lasterrtext = 'Source:t_comp_needpay_system->thecompchargeverify:调用单位缴费到帐复核过程时出错:' + sqlca.sqlerrtext
             ROLLBACK USING SQLCA;
             CLOSE TheCompChargeVerifyePro;
             return false
         end if
        
         FETCH TheCompChargeVerifyePro INTO :Ls_RetErrText,:Li_RetErr; 
         CLOSE TheCompChargeVerifyePro;
        
         if Li_RetErr <> 1 then
             lasterrtext = '调用单位到帐复核过程时出错,错误编码为( ' + string( Li_RetErr ) + ' ),错误原因为:' + Ls_RetErrText
             ROLLBACK USING SQLCA;
             RETURN FALSE;
         end if

    end if;
next   
 
COMMIT USING SQLCA;  
 
return true


上边的代码有什么问题吗?希望高手帮忙看看,不胜感激!

------解决方案--------------------
这样试试,把定义放到循环里看看


SQL code
string Ls_RetErrText,ls_ID,ls_aka_append,ls_AAE140,ls_AAE002
int Li_RetErr 
long ll_rows,ll_row

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有