create or replace package body CountBankData_20150617 is
type cursorCommon is ref cursor; --游标类型
strSQL varchar2(7000); --sql语句变量
strTemp varchar2(3000);
strTmp varchar2(3000); -- Author : ADMINISTRATOR
-- Created : 2005-3-3 8:50:34
-- Purpose : -- Public type declarations
--type <TypeName> is <Datatype>; -- Public constant declarations
--<ConstantName> constant <Datatype> := <Value>; -- Public variable declarations
--<VariableName> <Datatype>; -- Public function and procedure declarations
/*****************************************************************************--
--*******************************公共函数*************************************--
--*****************************************************************************/ /*-- 星期--*/ function getWeek(
strDate varchar2
)
return varchar2 is
sWeek varchar2(2);
begin
select decode(to_char(to_date(strDate,'yyyy-MM-dd')-1,'d'),1,'一',2,'二',3,'三',4,'四',5,'五',6,'六',7,'日')
into sWeek from dual;
return sWeek;
end ;
/*-- 合并日期--*/
function uniteDate(
gYear varchar2,
gMonth varchar2,
gDay varchar2
)
return varchar2 is
sDay varchar2(2);
sMonth varchar2(2);
strResult varchar2(10);
begin
if length(gMonth)=1 then
sMonth:='0'||gMonth;
else
sMonth:=gmonth;
end if;
if length(gDay)=1 then
sDay:='0'||gDay;
else
sDay:=gDay;
end if;
strResult:=gYear||'-'||sMonth||'-'||sDay;
return strResult;
end; /*-- 取序号--*/
function getNextNumber(
gfieldName varchar2,
gLength number
)return varchar2 is
intCount number;
intafa007 number;
strResult varchar2(20);
begin
select Count(*) into intCount from fa02 where upper(afa006)=upper(gfieldName);
if intCount=0 then
strResult:=addZero('1',gLength);
insert into fa02 (afa006,afa007) values (upper(gfieldName),1);
else
select afa007 into intafa007 from fa02 where upper(afa006)=upper(gfieldName);
strResult:=addzero(TO_CHAR(intafa007+1),gLength);
update fa02 set afa007=afa007+1 where upper(afa006)=upper(gfieldName);
end if;
return strResult;
end; --是否已经审核
function isAuditing(
gAAA010 Varchar2,
gBankOCode Varchar2,
gYear varchar2,
gMonth varchar2,
gDay varchar2
) return boolean is
intCount number;
intn number;
begin
select count(*) into intn from DCJGZK where FYHDM=gBankOCode and FCJYEAR=gYear and FCJTERM=gMonth and FCJRI=gDay and aaa010=gAAA010;
if intn>0 then
select FIFCJ into intCount from DCJGZK where FYHDM=gBankOCode and FCJYEAR=gYear and FCJTERM=gMonth and FCJRI=gDay and aaa010=gAAA010;
if intCount=1 then
return true;
else
return false;
end if;
else
return false;
end if;
end; --退回银行
procedure backbank(
gaaa010 AA11.AAA010%type,
gBankOCode varchar2,
gDate varchar2
) is
begin
--先插入财政退回待查 再删待查表
delete from fc77 where AAA010=gaaa010 and AFC015=gDate and AFA101=gBankOCode;
INSERT INTO fc77
(AFC401,AAA010,AFC001,AFA031,AFA051,AFA101,AAA011,AFC002,AFC003,AFC004,AFC005,AFA052,
AFA053,AFC006,AFC007,AFC008,AFA032,AFC009,AFC010,AFC011,AFC012,AFC013,AFC014,AFC015,AFC016,FZPH,DCLX,AFC200,AFC201)
select AFC401,AAA010,AFC001,AFA031,AFA051,AFA101,AAA011,AFC002,AFC003,AFC004,AFC005,AFA052,
AFA053,AFC006,AFC007,AFC008,AFA032,AFC009,AFC010,AFC011,AFC012,AFC013,AFC187,AFC015,AFC016,FZPH,DCLX,AFC200,AFC201
from fc74 where AAA010=gAAA010
and AFC015=gDate
and AFA101=gBankOCode; delete from fc74 where AAA010=gaaa010 and AFC015=gDate and AFA101=gBankOCode;
--将需要删除的bp01表中的数据备份到bp05中,再做删除操作先删除是为了防止重复备份 add at 2015年6月23日 15:25:56
delete from bp05 where (select f.aaa010 from bp05 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp05.abp205)=gaaa010 and abp101=gDate and abp203=gBankOCode;
insert into bp05(AFC501,ABP201,ABP202,ABP203,ABP204,ABP205,ABP206,ABP207,ABP208,ABP209,ABP101,ABP210,ABP211,ABP212,ABP213,ABP214) select AFC501,ABP201,ABP202,ABP203,ABP204,ABP205,ABP206,ABP207,ABP208,ABP209,ABP101,ABP210,ABP211,ABP212,ABP213,ABP214 from bp01 b where (select f.aaa010 from bp01 p,fpos02 f where p.abp205=f.aaa003 and p.abp205=b.abp205)=gaaa010 and b.abp101=gDate and b.abp203=gBankOCode;
delete from bp01 where (select f.aaa010 from bp01 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp01.abp205)=gaaa010 and abp101=gDate and abp203=gBankOCode; --将需要删除的bp02表中的数据备份到bp06中,再做删除操作先删除是为了防止重复备份 add at 2015年6月23日 15:25:56
delete from bp06 where (select f.aaa010 from bp06 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp06.abp205)=gaaa010 and abp101=gDate and abp203=gBankOCode;
insert into bp06(AFC401,ABP201,ABP202,ABP203,ABP204,ABP205,ABP206,ABP207,ABP208,ABP209,ABP101,ABP210,ABP211,ABP212,ABP213,ABP214,ABP222,ABP223) select AFC401,ABP201,ABP202,ABP203,ABP204,ABP205,ABP206,ABP207,ABP208,ABP209,ABP101,ABP210,ABP211,ABP212,ABP213,ABP214,ABP222,ABP223 from bp02 b where (select f.aaa010 from bp02 p,fpos02 f where p.abp205=f.aaa003 and p.abp205=b.abp205)=gaaa010 and b.abp101=gDate and b.abp203=gBankOCode;
delete from bp02 where (select f.aaa010 from bp02 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp02.abp205)=gaaa010 and abp101=gDate and abp203=gBankOCode; --将需要删除的bp04表中的数据备份到bp07中,再做删除操作先删除是为了防止重复备份 add at 2015年6月23日 15:25:56
delete from bp07 where (select f.aaa010 from bp07 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp07.abp205)=gaaa010 and abp101=gDate and abp203=gBankOCode;
insert into bp07(AFC401,AFC501,ABP201,ABP202,ABP203,ABP204,ABP205,ABP206,ABP207,ABP208,ABP209,ABP101,ABP210,ABP211,ABP212,ABP213,ABP214) select AFC401,AFC501,ABP201,ABP202,ABP203,ABP204,ABP205,ABP206,ABP207,ABP208,ABP209,ABP101,ABP210,ABP211,ABP212,ABP213,ABP214 from bp04 b where (select f.aaa010 from bp04 p,fpos02 f where p.abp205=f.aaa003 and p.abp205=b.abp205)=gaaa010 and b.abp101=gDate and b.abp203=gBankOCode;
delete from bp04 where (select f.aaa010 from bp04 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp04.abp205)=gaaa010 and abp101=gDate and abp203=gBankOCode; delete from fc78 where AAA010=gaaa010 and afc015=gDate and AFA101=gBankOCode;
INSERT INTO fc78
(AFC306,AAA010,AFC041,AFA050,AFC061,AFC062,AFC063,AFC064,AFC065,
AFC066,AFA091,AFC067,AFC015,AFA101,AFC001,AAZ015)
select AFC306,AAA010,AFC041,AFA050,AFC061,AFC062,AFC063,AFC064,AFC065,
AFC066,AFA091,AFC067,AFC015,AFA101,AFC001,'0'
from fc75 where AAA010=gaaa010
and afc015=gDate and AFA101=gBankOCode; delete from fc75 where AAA010= gaaa010
and afc015=gDate and AFA101=gBankOCode; delete from fc79 where AAA010=gaaa010 and AFC015=gDate and AFC153=gBankOCode;
INSERT INTO fc79
(AFC001,AFA031,AFC163,AFC187,AFC183,AFC157,AFC181,AFA040,AFC180,AFA192,AFA051,AFA053,
AFC166,AFC155,AFC153,AFC154,AFA183,AFA184,AFA185,AFA032,AFA052,AFC015,AAA010,AFC200,AFC201,AFA260)
select AFC001,AFA031,AFC163,AFC187,AFC183,AFC157,AFC181,AFA040,AFC180,AFA192,AFA051,AFA053,
AFC166,AFC155,AFC153,AFC154,AFA183,AFA184,AFA185,AFA032,AFA052,AFC015,AAA010,AFC200,AFC201,AFA260
from fc76
where AAA010=gAAA010 and AFC015=gDate and afc153=gBankOCode; delete from fc76 where AAA010=gaaa010 and AFC015=gDate and afc153=gBankOCode;
--删除单位间分成收入 add by zgz 20081210
delete from fc88 where AAA010=gaaa010 and afc015=gDate and afa101=gBankOcode and aaz100='1';
delete from fc88 where AAA010=gaaa010 and afc015=gDate and afc201=gBankOCode and aaz100='2';
-- delete from fc89 where fczqhnm=gaaa010 and fhkrq=gDate and fdsyhdm=gBankOCode;
--删除银行补录数据但未确认成功的
DELETE FROM fc84 WHERE AAA010=gaaa010 AND afc015=gDate AND afa101=gBankOcode AND fsfqr='0';
delete from DCJGZK where aaa010=gaaa010 and fyhdm=gBankOCode and fcjyear=substr(gdate,1,4) and fcjterm=substr(gdate,6,2) and fcjri=substr(gdate,9,2) ;
end; --统计银行 利息收入
procedure CountBankData(
gAAA010 AA11.AAA010%type,
gYear varchar2,
gMonth varchar2,
gDay varchar2,
gResult in out varchar2
) is
sDate varchar2(10);
sWeek varchar2(2);
sBankOCode fa22.afa101%type;
szcsrbs number;
szcsrje fc76.afc157%type;--正常收入
sdcsrbs number;
sdcsrje fc76.afc157%type;--待查收入
szhlxsr fc76.afc157%type;--财政专户利息收入
sdchlxsr fc76.afc157%type;--待查户利息收入
sdccmje fc76.afc157%type;--待查查明收入
sdccmbs number;
stfsrbs number;
stfsrje fc76.afc157%type;
zhstfsrbs number;
zhstfsrje fc76.afc157%type;
sdwjfcfcsr dcjgzk.dwjfcfcsr%type;
sdwjfcfrsr dcjgzk.dwjfcfrsr%type; syhye fc76.afc157%type;
sdatatype varchar(50);
syhbm varchar(5);--银行编码
syhmc varchar(200);
sjkshm varchar(20);
slsh varchar(50);
serr varchar(100);
sczqh varchar(10);
szje fc76.afc157%type;
sxmhjje fc76.afc157%type;
--add at 2015年6月18日
fzcsrposbs number;--正常收入POS笔数
fzcsrposje bp01.abp201%type;--正常收入POS金额
fdcsrposbs number;--待查收入POS笔数
fdcsrposje bp02.abp201%type;--待查收入POS金额
fdccmposbs number;--待查查明收入POS笔数
fdccmposje bp04.abp201%type;--待查查明收入POS金额 intFXH NUMBER;
csrCommon cursorCommon;
csrCheck cursorCommon;
begin
gResult:='0';
sDate:= uniteDate(gYear,gMonth,gDay);
sWeek:=getWeek(sDate);
-- strSQL:='select * from fa22';
strSQL:='select BankOCode,(zcsrbs+fzcsrposbs) zcsrbs,(nvl(zcsrje,0)+nvl(fzcsrposje,0)) zcsrje,fzcsrposbs,nvl(fzcsrposje,0) fzcsrposje,fdcsrposbs,nvl(fdcsrposje,0) fdcsrposje,fdccmposbs,nvl(fdccmposje,0) fdccmposje,(dcsrbs+fdcsrposbs) dcsrbs,(nvl(dcsrje, 0)+nvl(fdcsrposje, 0)) dcsrje,nvl(zhlxsr,0) zhlxsr,nvl(dchlxsr,0) dchlxsr,'
||' tfsrbs,nvl(tfsrje,0) tfsrje,zhtfsrbs,nvl(zhtfsrje,0) zhtfsrje, (nvl(zcsrje, 0) + nvl(dcsrje, 0) + nvl(dccmje, 0) - nvl(tfsrje, 0)- nvl(dwjfcfcsr, 0) + nvl(dwjfcfrsr, 0)) yhye,'
||'(nvl(dccmje,0)+nvl(fdccmposje, 0)) dccmje,(dccmbs+fdccmposbs) dccmbs,nvl(dwjfcfcsr,0) dwjfcfcsr,nvl(dwjfcfrsr,0) dwjfcfrsr from '
||' (select a.BankOCode,'
||'(select count(*) from fc76 where AAA010= '''||gAAA010
||''' and AFC015= '''||sDate||''' and AFC153=a.BankOCode) zcsrbs, '
||' (select zcsrje from (select AFC153 BankOCode,sum(nvl(AFC181,0)) zcsrje from fc76 '
||' where AFC015= '''||sDate||''' and AAA010= '''||gAAA010||''' group by AFC153) zc'
||' where zc.BankOCode=a.BankOCode) zcsrje,'
--正常收入POS add at 2015年6月18日
||'(select count(*) from bp01 where (select min(f.aaa010) from bp01 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp01.abp205)= '''||gAAA010
||''' and abp101= '''||sDate||''' and abp202=a.BankOCode) fzcsrposbs, '
||' (select fzcsrposje from (select abp202 BankOCode,sum(nvl(abp201,0)) fzcsrposje from bp01 '
||' where abp101= '''||sDate||''' and (select min(f.aaa010) from bp01 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp01.abp205)= '''||gAAA010||''' group by abp202) zcp'
||' where zcp.BankOCode=a.BankOCode) fzcsrposje,'
--待查收入POS
||'(select count(*) from bp02 where (select min(f.aaa010) from bp02 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp02.abp205)= '''||gAAA010
||''' and abp101= '''||sDate||''' and abp202=a.BankOCode) fdcsrposbs, '
||' (select fdcsrposje from (select abp202 BankOCode,sum(nvl(abp201 ,0)) fdcsrposje from bp02 '
||' where abp101 = '''||sDate||''' and (select min(f.aaa010) from bp02 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp02.abp205)= '''||gAAA010||''' group by abp202 ) dcp'
||' where dcp.BankOCode=a.BankOCode) fdcsrposje,'
--待查查明收入POS
||'(select count(*) from bp04 where (select min(f.aaa010) from bp04 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp04.abp205)= '''||gAAA010
||''' and abp101= '''||sDate||''' and abp202=a.BankOCode) fdccmposbs, '
||' (select fdccmposje from (select abp202 BankOCode,sum(nvl(abp201 ,0)) fdccmposje from bp04 '
||' where abp101 = '''||sDate||''' and (select min(f.aaa010) from bp04 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp04.abp205)= '''||gAAA010||''' group by abp202 ) dccmp'
||' where dccmp.BankOCode=a.BankOCode) fdccmposje,' ||' (select count(*) from FC74 where AAA010= '''||gAAA010
||''' and AFC015= '''||sDate||''' and AFA101=a.BankOCode and DCLX=''00'') dcsrbs, '
||' (select dcsrje from (select AFA101 BankOCode,sum(nvl(AFC011,0)) dcsrje from FC74 '
||' where AFC015= '''||sDate||''' and AAA010= '''||gAAA010||''' and dclx=''00'' group by AFA101) dc '
||' where dc.BankOCode=a.BankOCode ) dcsrje,'
||' (select dcsrje from (select AFA101 BankOCode,sum(nvl(AFC011,0)) dcsrje from FC74 '
||' where AFC015= '''||sDate||''' and AAA010= '''||gAAA010||''' and dclx=''L1'' group by AFA101) dc '
||' where dc.BankOCode=a.BankOCode ) zhlxsr,'
||' (select dcsrje from (select AFA101 BankOCode,sum(nvl(AFC011,0)) dcsrje from FC74 '
||' where AFC015= '''||sDate||''' and AAA010= '''||gAAA010||''' and dclx=''L2'' group by AFA101) dc '
||' where dc.BankOCode=a.BankOCode ) dchlxsr,'
||' (select count(*) from fc75 where AAA010= '''||gAAA010
||''' and afc015= '''||sDate||''' and AFA101=a.BankOCode) tfsrbs, '
||' (select tfje from (select AFA101 BankOCode,sum(nvl(AFC064,0)) tfje from FC75 '
||' where afc015= '''||sDate||''' and AAA010= '''||gAAA010||''' group by AFA101) tf '
||' where tf.BankOCode=a.BankOCode ) tfsrje, ' ||' (select count(*) from fc75 where AAA010= '''||gAAA010
||''' and afc015= '''||sDate||''' and AFA101=a.BankOCode and afc066=''0'') zhtfsrbs, '
||' (select tfje from (select AFA101 BankOCode,sum(nvl(AFC064,0)) tfje from FC75 '
||' where afc015= '''||sDate||''' and AAA010= '''||gAAA010||''' and afc066=''0'' group by AFA101) tf '
||' where tf.BankOCode=a.BankOCode ) zhtfsrje, ' ||' (select count(*) from FC84 where AAA010='''||gAAA010
||''' and AFC015='''||sDate||''' and AFA101=a.BankOCode) dccmbs,' ||'(select dccmje from (select AFA101 BankOCode,sum(nvl(AFC011,0)) dccmje from FC84 '
||' where AFC015='''||sDate||''' and AAA010='''||gAAA010
||''' group by AFA101) dccm where dccm.BankOCode=a.BankOCode ) dccmje, ' ||' (select afc183 from (select afc201 BankOcode,sum(nvl(afc183, 0)) afc183 from fc88 '
||' where aaa010 ='''|| gAAA010
||''' and afc015 ='''||sDate
||''' and aaz100 = ''2'''
||' group by Afc201) dwfc where dwfc.BankOCode = a.BankOCode) dwjfcfcsr, ' ||' (select afc183 from (select afa101 BankOcode,sum(nvl(afc183, 0)) afc183 from fc88 '
||' where aaa010 ='''|| gAAA010
||''' and afc015 ='''||sDate
||''' and aaz100 = ''1'''
||' group by Afa101) dwfc where dwfc.BankOCode = a.BankOCode) dwjfcfrsr ' ||' from ' ||' (select c.afa101 BankOCode from '
||' (select fyhdm BankOCode from DCJGZK where FCJYEAR=to_number('''||gYear||''') '
||' and FCJTERM=to_number('''||gMonth||''') '
||' and FCJRI=to_number('''||gDay||''') and FIFCJ=0 '
||' union '
||' select AFC153 BankOCode from fc76 where AAA010='''||gAAA010||''' and AFC015='''||sDate||''' group by AFC153 '
||' union '
||' select AFA101 BankOCode from fc74 where AAA010='''||gAAA010||''' and AFC015='''||sDate||''' group by AFA101 '
||' union '
||' select AFA101 BankOCode from fc84 where AAA010='''||gAAA010||''' and fsfqr=''0'' and AFC015='''||sDate||''' group by AFA101 '
||' union '
--正常、待查、待查查明 add at 2015年6月19日<start----->
||' select abp202 BankOCode from bp01 where (select min(f.aaa010) from bp01 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp01.abp205)='''||gAAA010||''' and abp101 ='''||sDate||''' group by abp202 '
||' union '
||' select abp202 BankOCode from bp02 where (select min(f.aaa010) from bp02 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp02.abp205)='''||gAAA010||''' and abp101 ='''||sDate||''' group by abp202 '
||' union '
||' select abp202 BankOCode from bp04 where (select min(f.aaa010) from bp04 b,fpos02 f where b.abp205=f.aaa003 and b.abp205=bp04.abp205)='''||gAAA010||''' and abp101='''||sDate||''' group by abp202 '
||' union '
--<end----->
||' select AFA101 BankOCode from fc75 where AAA010='''||gAAA010||''' and afc015='''||sDate||''' group by AFA101 '
||' union '
||' select afa101 BankOCode from fc88 where aaa010 = '''||gAAA010||''' and afc015 = '''||sDate||''' and aaz100 = ''1'' group by Afa101 '
||' union '
||' select afc201 BankOCode from fc88 where aaa010 = '''||gAAA010||''' and afc015 = '''||sDate||''' and aaz100 = ''2'' group by Afc201 '
||' ) b,'
||' fa22 c where b.BankOCode=c.afa101 and c.aaa010='''||gAAA010||''' ) a) '; open csrCommon for strSQL;
fetch csrCommon into sBankOCode,szcsrbs,szcsrje,fzcsrposbs,fzcsrposje,fdcsrposbs,fdcsrposje,fdccmposbs,fdccmposje,sdcsrbs,sdcsrje,szhlxsr,sdchlxsr,stfsrbs,stfsrje,zhstfsrbs,zhstfsrje,syhye,sdccmje,sdccmbs,sdwjfcfcsr,sdwjfcfrsr;
while csrCommon%FOUND Loop -- 是否已接收审核则不统计
if not isAuditing(gAAA010,sBankOCode,gYear,gMonth,gDay) then --删除DCJGZK(会计核算_采集跟踪库)中某家银行指定日期的采集记录
delete from DCJGZK where aaa010=gAAA010 and fyhdm=sBankOCode and FCJYEAR=To_number(gYear) and FCJTERM=To_number(gMonth) and FCJRI=To_number(gDay); if not (szcsrbs=0 and fzcsrposbs=0 and fdcsrposbs=0 and fdccmposbs=0 and sdcsrbs=0 and stfsrbs=0 and sdccmbs=0 and szhlxsr=0 and sdchlxsr=0 and sdwjfcfcsr=0 and sdwjfcfrsr=0) then --校验fc76表和fc74表,如有错误则将该银行数据退回,Continue继续处理下面数据
strTemp:='select datatype,yhbm,yhmc, '''||sDate||''' as afc015, jkshm,zje,xmhjje,lsh,err,'''||gAAA010||''' as czqh from ('
||' select ''正常收入数据'' as dataType,a.yhbm,yhmc,a.jkshm,a.zje,a.xmhjje,'''' lsh,''总金额不等于项目合计金额'' err from'
||' (select fa22.AFA101 yhbm,fa22.AFA102 yhmc,fc76.AFC001 jkshm,fc76.AFC157 zje,sum(fc76.AFC181) xmhjje'
||' from fc76,fa22 where fc76.AFC153=fa22.AFA101 and fc76.AAA010='''||gAAA010||''' and fa22.AAA010='''||gAAA010||''''
||' and fc76.AFC015='''||sDate||''' and fc76.AFC153='''||sBankOCode||''' group by fa22.AFA101,fa22.AFA102,AFC001,AFC157) a'
||' where a.ZJE<>a.XMHJJE '
||' union all '
--bp01表《正常收入》中 总金额不等于项目合计金额的数据
||' select ''正常收入数据'' as dataType,a.yhbm,yhmc,a.jkshm,a.zje,a.xmhjje,'''' lsh,''总金额不等于项目合计金额'' err from'
||' (select fe20.afa051 yhbm,fe20.afa052 yhmc,fe20.afc001 jkshm,bp01.abp201 zje,fe20.afc157 xmhjje'
||' from bp01,fe20 where bp01.afc501=fe20.afc501 and (select f.aaa010 from bp01 b,fpos02 f where b.abp205=f.aaa003 and b.abp205= bp01.abp205)='''||gAAA010||''''
||' and bp01.abp101='''||sDate||''' and bp01.abp203='''||sBankOCode||''' group by fe20.afa051,fe20.afa052,fe20.afc001,bp01.abp201,fe20.afc157) a'
||' where a.ZJE<>a.XMHJJE '
||' union all '
||' select ''待查收入数据'' as dataType,fa22.AFA101 yhbm,fa22.AFA102 as yhmc,'''' as jkshm,0 as zje,0 as xmhjje,fc74.AFC401 lsh,''缺收款人全称项'' as err'
||' from fc74,fa22 where fc74.AFA101=fa22.AFA101 and fc74.AAA010='''||gAAA010||''' and fa22.AAA010='''||gAAA010||''' and fc74.AFC015='''||sDate||''' and fc74.AFA101='''||sBankOCode||''''
||' and trim(fc74.AFC002) is null '
||' union all '
||' select ''待查收入数据'' as dataType,fa22.AFA101 yhbm,fa22.AFA102 as yhmc,'''' as jkshm,0 as zje,0 as xmhjje,fc74.AFC401 lsh,''缺收款人开户行项'' as err'
||' from fc74,fa22'
||' where fc74.AFA101=fa22.AFA101 and fc74.AAA010='''||gAAA010||''' and fa22.AAA010='''||gAAA010||''' and fc74.AFC015='''||sDate||''' and trim(fc74.AFC003) is null '
||' union all '
||' select ''待查收入数据'' as dataType,fa22.AFA101 yhbm,fa22.AFA102 as yhmc,'''' as jkshm,0 as zje,0 as xmhjje,fc74.AFC401 lsh,''缺收款人账号项'' as err'
||' from fc74,fa22 '
||' where fc74.AFA101=fa22.AFA101 and fc74.AAA010='''||gAAA010||''' and fa22.AAA010='''||gAAA010||''' and fc74.AFC015='''||sDate||''' and trim(fc74.AFC004) is null '
||' union all '
--缺票号项 bp02表中的票号均为空
||' select ''待查收入数据'' as dataType,fe20.afa051 yhbm,fe20.afa052 as yhmc,'''' as jkshm,0 as zje,0 as xmhjje,fe20.afc150 lsh,''缺票号项'' as err '
||' from fe20 '
||' where fe20.afc015 ='''||sDate||''' '
||' union all '
--收款金额不大于0
||' select ''待查收入数据'' as dataType,fe20.afa051 yhbm,fe20.afa052 as yhmc,'''' as jkshm,0 as zje,0 as xmhjje,bp02.AFC401 lsh,''bp02收费金额不大于0'' err'
||' from bp02,fe20 '
||' where bp02.abp203=fe20.afc153 and bp02.abp201<=0 and (select min(f.aaa010) from bp02 b,fpos02 f where b.abp205=f.aaa003 and b.abp205= bp02.abp205)='''||gAAA010||''' and bp02.abp101='''||sDate||''' and bp02.abp203='''||sBankOCode||''' '
||' union all '
||' select ''待查收入数据'' as dataType,fa22.AFA101 yhbm,fa22.AFA102 as yhmc,'''' as jkshm,0 as zje,0 as xmhjje,fc74.AFC401 lsh,''收费金额不大于0'' err'
||' from fc74,fa22 '
||' where fc74.AFA101=fa22.AFA101 and fc74.AFC011<=0 and fc74.AAA010='''||gAAA010||''' and fa22.AAA010='''||gAAA010||''' and fc74.AFC015='''||sDate||''' and fc74.AFA101='''||sBankOCode||''''
||' ) order by dataType,yhbm,yhmc,jkshm,lsh '; open csrCheck for strTemp;
fetch csrCheck into sdatatype,syhbm,syhmc,sdate,sjkshm,szje,sxmhjje,slsh,serr,sczqh;
if csrCheck%found then
strTmp:='delete from banktran where afc015='''||sdate||''' and yhbm ='''||syhbm||''' ';
execute immediate strTmp;
strTmp:='insert into banktran(datatype,yhbm,yhmc,afc015,jkshm,zje,xmhjje,lsh,err,aaa010) '
||strTemp;
execute immediate strTmp;
-- 退回银行
backbank(gAAA010,sBankOCode,sDate);
gResult:='1';
else --记跟踪采集数据
intFXH:=to_number(getnextnumber('FXH',20));
insert into dcjgzk (FXH,FCJYEAR,FCJTERM,FCJRI,FIFCJ,FXQ,FZCSRJE,FZCSRBS,SZCSRPOSJE,SZCSRPOSBS,SDCSRPOSJE,SDCSRPOSBS,SDCCMPOSJE,SDCCMPOSBS,
FDCSRJE,FDCSRBS,FTFSRJE,FTFSRBS,FCZZZS,fdccmje,fdccmbs,fyhdm,aaa010,fzhlxsr,fdchlxsr,zhftfsrbs,zhftfsrje,dwjfcfcsr,dwjfcfrsr) values (intFXH,To_number(gYear),To_number(gMonth),
To_number(gDay),0,sWeek,szcsrje,szcsrbs,fzcsrposje,fzcsrposbs,fdcsrposje,fdcsrposbs,fdccmposje,fdccmposbs,sdcsrje,sdcsrbs,stfsrje,stfsrbs,syhye,sdccmje,sdccmbs,sBankOCode,gAAA010,szhlxsr,sdchlxsr,zhstfsrbs,zhstfsrje,sdwjfcfcsr,sdwjfcfrsr);
end if;
close csrCheck;
end if;
end if;
fetch csrCommon into sBankOCode,szcsrbs,szcsrje,fzcsrposje,fzcsrposbs,fdcsrposje,fdcsrposbs,fdccmposje,fdccmposbs,sdcsrbs,sdcsrje,szhlxsr,sdchlxsr,stfsrbs,stfsrje,zhstfsrbs,zhstfsrje,syhye,sdccmje,sdccmbs,sdwjfcfcsr,sdwjfcfrsr; End Loop;
close csrCommon;
commit; exception --异常处理
when others then
gResult:='统计银行数据出现错误,请稍后重试!';
end;
end CountBankData_20150617;

一个不简单的Procedure body例子的更多相关文章

  1. php这是一个随机打印输出字符串的例子

    <?php header("Content-type:text/html;charset='utf8'"); error_reporting(E_ALL); define(& ...

  2. [转]一个简单的Linux多线程例子 带你洞悉互斥量 信号量 条件变量编程

    一个简单的Linux多线程例子 带你洞悉互斥量 信号量 条件变量编程 希望此文能给初学多线程编程的朋友带来帮助,也希望牛人多多指出错误. 另外感谢以下链接的作者给予,给我的学习带来了很大帮助 http ...

  3. 一个简单的iBatis入门例子

    一个简单的iBatis入门例子,用ORACLE和Java测试 目录结构: 1.导入iBatis和oracle驱动. 2.创建类Person.java package com.ibeats;import ...

  4. 和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧。因为,很多PCI的例子都是对S5933,就连微软出版的《Programming the Microsoft Windows Driver Model》都提供了一个完整的S5933的例子。 在这篇有关DDK的开发论文里。

    和S5933比较起来,开发PLX9054比较不幸,可能是第一次开发PCI的缘故吧.因为,很多PCI的例子都是对S5933,就连微软出版的<Programming the Microsoft Wi ...

  5. ICE第二篇--一个"hello world"的简单例子

    1 本文介绍一个hello world输出的例子. ice应用的步骤如下: 1. 编写 Slice 定义并编译它. 2. 编写服务器并编译它. 3. 编写客户并编译它. 基本框架图示: 本文代码图示: ...

  6. 一个LinkedBlockingQueue线程安全的例子

    一个LinkedBlockingQueue线程安全的例子 package llj.mf.ace; import java.util.ArrayList; import java.util.HashSe ...

  7. PCIe扫盲——一个Memory Read操作的例子

    连载目录篇:http://blog.chinaaet.com/justlxy/p/5100053251 前面的一系列文章简要地介绍了PCIe总线的结构.事务层.数据链路层和物理层.下面我们用一个简单地 ...

  8. 2.1 一个简单的Web工程例子

    一个简单的Web工程例子 开发环境: Eclipse: Neon Release (4.6.0) JDK:1.8.0_92 Tomcat:8.5.9 Maven:3.3.9 1. 在Eclipse中创 ...

  9. 20个Flutter实例视频教程-第10节: 一个不简单的搜索条-1

    20个Flutter实例视频教程-第10节: 一个不简单的搜索条-1 视频地址: https://www.bilibili.com/video/av39709290/?p=10 博客地址: https ...

随机推荐

  1. 黄聪:HtmlAgilityPack教程案例

    HtmlAgilityPack中的HtmlNode类与XmlNode类差不多,提供的功能也大同小异.下面来看看该类提供功能. 一.静态属性 public static Dictionary<st ...

  2. The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved

    偶在页面里引入了标签如下:     <%@   taglib   prefix="c"   uri="http://java.sun.com/jstl/core&q ...

  3. [技巧]实际项目中background-image应写在页面上

    摘自:http://www.zhangxinxu.com 因为实际项目中(数据对接时),这肯定是个动态的URL地址,css文件似乎不支持动态URL 地址. <img src="../i ...

  4. sublime代码片段功能

    tools - > developer - > new snippet有了这个,你就可以通过iu这两个键,直接弄出自己的模板了,这就很方便了,不用在复制粘贴了.上是代码模板,下面是快捷键, ...

  5. Codeforces Round #358 (Div. 2)B. Alyona and Mex

    B. Alyona and Mex time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  6. [复变函数]第15堂课 4.3 解析函数的 Taylor 展式

    1.  Taylor 定理: 设 $f(z)$ 在 $K:|z-a|<R$ 内解析, 则 $$\bee\label{15:taylor} f(z)=\sum_{n=0}^\infty c_n(z ...

  7. 关于this指向思考

    事情起因为<js函数式编程指南>里面看到这段话: 上例DB对象中的save方法作为参数传入到fs的readFile,按道理this指向DB,为啥作者的意思是存在this指针可能会指向其他地 ...

  8. JAVA 流式布局管理器

    //流式布局管理器 import java.awt.*; import javax.swing.*; public class Jiemian2 extends JFrame{ //定义组件 JBut ...

  9. Windows 64位下安装Redis详细教程

    方法/步骤 在D盘新建文件夹[redis],右键解压Redis ZIP包,把所有文件解压到redis文件夹中.(其他盘符也可以滴^_^) 文件介绍: redis-benchmark.exe       ...

  10. ubuntu14.04 彻底重装mysql&phpmyadmin

    ---恢复内容开始--- 因为很久没用mysql,突然发现密码忘记了,折腾半天后,怎么也改不会来了!再此记一下,彻底重新删除再安装的过程. step1. 卸载: sudo apt-get remove ...