一个通过Oracle8i存储过程返回记录集的程序包(存储过程)
2008-05-13 16:07:15 来源:WEB开发网*/
---功能:把满足条件的二级代理商转帐信息导入数据库 Start
strSQL:='Insert Into TEMPAgtBankFlow
Select A.Agent_Mobile,A.Bank_Glide,
Decode(A.OPTCode,''100'',''交款交易'',''101'',''交款冲正'',''900'',''抹帐交易'',''类型不明'') as TradeType,A.Trade_Money,
TO_Char(To_Date(A.Trade_Date,''YYYYMMDD''),''YYYY-MM-DD'') as TradeDate,
TO_Char(To_Date(A.Trade_Time,''hh24miss''),''hh24:mi:ss'') as TradeTime,B.BankName,C.AreaCode,C.AreaName,
(Case When CheckFlag=-1 Then ''/Images/state_rollback.gif'' When SuccFlag=-1 Then ''/Images/state_cancel.gif'' When StatusFlag=-1 Then ''/Images/state_unnormal.gif'' Else ''/Images/state_normal.gif'' End) as State,
A.CheckFlag,A.StatusFlag,A.SuccFlag
From Bank_Stream_Account A,BankInfoConfig B,AreaConfig C,SecAgtAccount D,FstAgtAccount E
Where A.Bank_ID=B.BankCode And Trim(A.Agent_Mobile)=D.AgtID And D.BossAgtID=E.AgtID And C.CityCode=E.CityCode ';
IF AreaCode!='0' Then --条件1: 选择所有地区的信息
strSQL:=strSQL || ' And Trim(C.AreaCode)=''' || AreaCode || ''' ';
End IF;
IF startTradeDate!=' ' Then --条件2: 选择所有地区的信息,选择所有交易开始日期的信息
strSQL:=strSQL || ' And TO_Char(To_Date(A.Trade_Date,''YYYYMMDD''),''YYYY-MM-DD'')>=''' || startTradeDate || ''' ';
End If;
IF endTradeDate!=' ' Then --条件2: 选择所有地区的信息,选择所有交易截止日期的信息
strSQL:=strSQL || ' And TO_Char(To_Date(A.Trade_Date,''YYYYMMDD''),''YYYY-MM-DD'')<=''' || endTradeDate || ''' ';
End If;
IF KeyWord!=' ' Then --条件3: 选择所有地区的信息,选择所有交易日期的信息,选择和查询关键字匹配的信息
strSQL:=strSQL || ' And (D.AgtID Like''%' || KeyWord || '%'' Or TO_Char(A.BANK_GLIDE) Like ''%' || KeyWord || '%'' Or B.BankName Like ''%' || KeyWord ||'%'') ';
End If;
Execute Immediate strSQL;
---功能:把满足条件的二级代理商转帐信息导入数据库 End
Open Re_CURSOR For 'Select * From Sms_pay.TEMPAgtBankFlow Order by AgtID'; --生成返回结果集的Curso
ret:=0;
return;
Exception
when others then
DBMS_OUTPUT.PUT_LINE(SQLERRM);
ret:=999;
return;
End GetAgtBankFlow;
--功能描述:查询代理商钱包余额信息 writer: wang haibo 2004-08-24
PROCEDURE GetAgtBalance(AreaCode in varchar2,KeyWord in varchar2,Re_CURSOR OUT T_CURSOR,ret out number)
is
pFSTAGTID VARCHAR2(13);
pSECAgtID VARCHAR2(13);
pAgtBalance NUMBER(10,2);
pAgtProfit NUMBER(10,2);
pAreaCode VARCHAR2(10);
pAreaName VARCHAR2(30);
pAgtCount NUMBER(10);
IsExists number;
subAgtNumber number;
type c_GetBalance is ref cursor;
FstCursor c_GetBalance;
strSQL VARCHAR2(1024);
Begin
更多精彩
赞助商链接