WEB开发网
开发学院数据库Oracle 一个通过Oracle8i存储过程,返回记录集的程序包(存... 阅读

一个通过Oracle8i存储过程,返回记录集的程序包(存储过程)

 2007-05-13 12:30:28 来源:WEB开发网   
核心提示: Open Re_CURSOR For 'Select * From Sms_pay.TEMPAgtBankFlow Order by AgtID';--生成返回结果集的Cursoret:=0;return;Exception when others then DBMS_OU
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
  -- 打开游标,根据SQL语句获取1级代理商资料,然后根据1级代理商的资料获取2级代理的信息
  IF AreaCode!='0' And KeyWord=' ' Then
   strSQL:='Select A.AgtID,'''',A.Agtcredit,A.AgtProfit,
       B.AreaCode,B.AreaName,0 From Sms_Pay.FstAgtAccount A,Sms_Pay.AreaConfig B
       Where A.IsActive=1 And A.CityCode=B.CityCode And B.AreaCode =''' || AreaCode ||'''';     
    
  ElsIf (Trim(AreaCode)!='0' And KeyWord!=' ') Then
   strSQL:='Select A.AgtID,'''',A.Agtcredit,A.AgtProfit,
       B.AreaCode,B.AreaName,0 From Sms_Pay.FstAgtAccount A,Sms_Pay.AreaConfig B
       Where A.IsActive=1 And A.CityCode=B.CityCode And B.AreaCode =''' || AreaCode ||
       ''' And (B.AreaName Like ''%' || Trim(KeyWord) || '%'' Or A.AgtID Like ''%' || Trim(KeyWord) || '%'')';
  ElsIf (Trim(AreaCode)='0' And KeyWord=' ') Then
   strSQL:='Select A.AgtID,'''',A.Agtcredit,A.AgtProfit,
       B.AreaCode,B.AreaName,0 From Sms_Pay.FstAgtAccount A,Sms_Pay.AreaConfig B
       Where A.IsActive=1 And A.CityCode=B.CityCode';        
  Else
   strSQL:='Select A.AgtID,'''',A.Agtcredit,A.AgtProfit,
       B.AreaCode,B.AreaName,0 From Sms_Pay.FstAgtAccount A,Sms_Pay.AreaConfig B
       Where A.IsActive=1 And A.CityCode=B.CityCode
       And (B.AreaName Like ''%' || KeyWord || '%'' Or A.AgtID Like ''%' || KeyWord || '%'')';
  End If;
 
  Open FstCursor For strSQL;

--检查临时表是否已经存在,如果不存在,则创建,否则插入数据 start

上一页  1 2 3 4 5 6  下一页

Tags:一个 通过 Oraclei

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接