数据不多,但速度奇慢,有什么问题了,看我的PL/SQL
Stime:=to_char(sysdate-to_number(to_char(sysdate - 1, 'D '))+1, 'YYYY-MM-DD ');
Etime:=to_char(sysdate-to_number(to_char(sysdate - 1, 'D '))+1, 'YYYY-MM-DD ');
Open TEMP_CURSOR For select IBITM,IBLITM,IBMCU,IBVEND,
(select ABALKY from F0101 where A.IBVEND=F0101.ABAN8 and rownum <2),
(select IMLITM from F4101 where A.IBITM=F4101.IMITM and rownum <2),
(select IMDSC1 from F4101 where A.IBITM=F4101.IMITM and rownum <2),IBLTLV,
(select BPUPRC from F4106 where A.IBITM=F4106.BPITM and rownum <2),
(select ABALPH from F0101 where A.IBBUYR=F0101.ABAN8 and rownum <2),
(select ABALPH from F0101 where A.IBANPL=F0101.ABAN8 and rownum <2),IBSAFE,
(select sum(LIPQOH) from F41021 where A.IBITM=LIITM and A.IBMCU=LIMCU),
(select Sum(F4311.PDUOPN) from F4311 where A.IBVEND=F4311.PDAN8 and A.IBMCU=F4311.PDMCU and A.IBITM=F4311.PDITM and F4311.PDUOPN> 0),
Nvl((select sum(SDUORG) from F4211 where trim(SDITM)=trim(A.IBITM) and trim(SDMCU)=trim(A.IBMCU) and SDNXTR < '560 ' and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ')> =to_char(to_Date(Stime, 'yyyy/mm/dd '), 'YYYY-MM-DD ') and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ') <to_char(to_Date(Etime, 'yyyy/mm/dd ')+1 *7, 'YYYY-MM-DD ')),0),
Nvl((select sum(SDUORG) from F4211 where trim(SDITM)=trim(A.IBITM) and trim(SDMCU)=trim(A.IBMCU) and SDNXTR < '560 ' and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ')> =to_char(to_Date(Stime, 'yyyy/mm/dd ')+1*7 , 'YYYY-MM-DD ') and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ') <to_char(to_Date(Etime, 'yyyy/mm/dd ')+2*7, 'YYYY-MM-DD ')),0),
Nvl((select sum(SDUORG) from F4211 where trim(SDITM)=trim(A.IBITM) and trim(SDMCU)=trim(A.IBMCU) and SDNXTR < '560 ' and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ')> =to_char(to_Date(Stime, 'yyyy/mm/dd ')+2*7 , 'YYYY-MM-DD ') and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ') <to_char(to_Date(Etime, 'yyyy/mm/dd ')+3*7, 'YYYY-MM-DD ')),0),
Nvl((select sum(SDUORG) from F4211 where trim(SDITM)=trim(A.IBITM) and trim(SDMCU)=trim(A.IBMCU) and SDNXTR < '560 ' and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ')> =to_char(to_Date(Stime, 'yyyy/mm/dd ')+3*7 , 'YYYY-MM-DD ') and to_char(to_date(to_char(SDDRQJ+1900000), 'YYYYDDD '), 'YYYY-MM-DD ') <to_char(to_Date(Etime, 'yyyy/mm/dd ')+4*7, 'YYYY-MM-DD ')),0),
Nvl((select sum(SDUORG) from F4211 where trim(SDITM)=trim(A.IBITM) and trim(SDMCU)=trim(A.IBMCU) and SDNXTR < '560 ' &n