一个通过Oracle8i存储过程,返回记录集的程序包(存储过程)
2007-05-13 12:30:28 来源:WEB开发网核心提示: strSQL:='Insert into TEMPAgtBalance Select null,AGTID,''' || pFSTAGTID ||''',AGTCREDIT,AGTPROFIT ,''' ||
strSQL:='Insert into TEMPAgtBalance Select null,AGTID,''' || pFSTAGTID ||''',AGTCREDIT,AGTPROFIT ,''' || pAreaCode || ''',''' || pAreaName || ''',0 From SecAgtAccount Where Trim(BOSSAGTID)=''' || pFSTAGTID || '''';
Execute Immediate strSQL;
--3:更新1级代理的下级别代理商数量
strSQL:='Select Count(*) From TEMPAgtBalance Where SECAgtID is not null And ParentID=''' || pFSTAGTID || '''';
--DBMS_OUTPUT.PUT_LINE(strSQL);
Execute Immediate strSQL Into subAgtNumber;
--Select Count(*) Into subAgtNumber From TEMPAgtBalance Where SECAgtID is not null And ParentID=pFSTAGTID;
DBMS_OUTPUT.PUT_LINE(subAgtNumber);
strSQL:='Update TEMPAgtBalance Set AgtCount=' || subAgtNumber || ' Where SECAgtID is null And FSTAGTID=''' || pFSTAGTID || '''';
Execute Immediate strSQL;
--DBMS_OUTPUT.PUT_LINE(strSQL);
--Update TEMPAgtBalance Set AgtCount=subAgtNumber Where SECAgtID is null And FSTAGTID=pFSTAGTID;
End loop;
Close FstCursor;
Open Re_CURSOR For 'Select * From Sms_pay.TEMPAgtBalance';
ret:=0;
return;
Exception
when others then
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ret:=999;
return;
End GetAgtBalance;
End ;
更多精彩
赞助商链接