-
一个小时过去了200条记录 都还没写进去 效率低的可怕,求解0
create or replace procedure SP_MSS_AGING is amount Number(18, 2);-- 未逾期 overdue1 Number(18, 2); --逾期0-6个月 overdue2 Number(18, 2); --逾期6-12月 overdue3 Number(18, 2); --逾期12-18个月 overdue4 Number(18, 2); --逾期18-24月 overdue5 Number(18, 2); --逾期以上两年 begin declare CURSOR companyRow IS select bf01.scc_company_id, bf01.SETTLE_TYPE_NO from TB_MSS_SETT_CONTRACT bf01, TB_MSS_SC_ACC_RECV_DET bf06, TB_MSS_SETT_INVOICE bf02, TB_SCC_WF_PROC_MAIN ac03, TB_MSS_SC_ACC_RECV bt01 where ac03.target_table_name = 'TB_MSS_SETT_INVOICE' and ac03.target_table_id = bf02.mss_sett_invoice_id and bf02.mss_sett_contract_id = bf01.mss_sett_contract_id and bf01.mss_sett_contract_id = bf06.mss_sett_contract_id and bf06.MSS_SC_ACC_RECV_ID = bt01.mss_sc_acc_recv_id and bf01.NOTE_STATE = 2 and ac03.STATUS = '4' and not (bt01.AR_STATUS = '2') and to_char(trunc(ACC_RECV_DATE), 'yyyy-mm') = to_char(add_months(trunc(sysdate), -1), 'yyyy-mm') group by bf01.scc_company_id, bf01.SETTLE_TYPE_NO; aging companyRow%rowtype; begin for aging in companyRow loop begin select sum(bt01.AR_AMOUNT) into amount from TB_MSS_SETT_CONTRACT bf01, TB_MSS_SC_ACC_RECV_DET bf06, TB_MSS_SETT_INVOICE bf02, TB_SCC_WF_PROC_MAIN ac03, TB_MSS_SC_ACC_RECV bt01 where ac03.target_table_name = 'TB_MSS_SETT_INVOICE' and ac03.target_table_id = bf02.mss_sett_invoice_id and bf02.mss_sett_contract_id = bf01.mss_sett_contract_id and bf01.mss_sett_contract_id = bf06.mss_sett_contract_id and bf06.MSS_SC_ACC_RECV_ID = bt01.mss_sc_acc_recv_id and bt01.OVERDUED = '0' and bf01.NOTE_STATE = 2 and ac03.STATUS = '4' and not (bt01.AR_STATUS = '2') and bf01.scc_company_id = aging.scc_company_id and bf01.SETTLE_TYPE_NO = aging.SETTLE_TYPE_NO and to_char(trunc(ACC_RECV_DATE), 'yyyy-mm') = to_char(add_months(trunc(sysdate), -1), 'yyyy-mm') group by bf01.scc_company_id, bf01.SETTLE_TYPE_NO; EXCEPTION WHEN NO_DATA_FOUND THEN amount := 0; end; begin select sum(bt01.AR_AMOUNT) into overdue1 from TB_MSS_SETT_CONTRACT bf01, TB_MSS_SC_ACC_RECV_DET bf06, TB_MSS_SETT_INVOICE bf02, TB_SCC_WF_PROC_MAIN ac03, TB_MSS_SC_ACC_RECV bt01 where ac03.target_table_name = 'TB_MSS_SETT_INVOICE' and ac03.target_table_id = bf02.mss_sett_invoice_id and bf02.mss_sett_contract_id = bf01.mss_sett_contract_id and bf01.mss_sett_contract_id = bf06.mss_sett_contract_id and bf06.MSS_SC_ACC_RECV_ID = bt01.mss_sc_acc_recv_id and bt01.OVERDUED = '1' and bf01.NOTE_STATE = 2 and ac03.STATUS = '4' and not (bt01.AR_STATUS = '2') and bf01.scc_company_id = aging.scc_company_id and bf01.SETTLE_TYPE_NO = aging.SETTLE_TYPE_NO and to_char(trunc(ACC_RECV_DATE), 'yyyy-mm') = to_char(add_months(trunc(sysdate), -1), 'yyyy-mm') and months_between(sysdate, ACC_RECV_DATE) <= 6 and months_between(sysdate, ACC_RECV_DATE) >= 0 group by bf01.scc_company_id, bf01.SETTLE_TYPE_NO; EXCEPTION WHEN NO_DATA_FOUND THEN overdue1 := 0; end; begin select sum(bt01.AR_AMOUNT) into overdue2 from TB_MSS_SETT_CONTRACT bf01, TB_MSS_SC_ACC_RECV_DET bf06, TB_MSS_SETT_INVOICE bf02, TB_SCC_WF_PROC_MAIN ac03, TB_MSS_SC_ACC_RECV bt01 where ac03.target_table_name = 'TB_MSS_SETT_INVOICE' and ac03.target_table_id = bf02.mss_sett_invoice_id and bf02.mss_sett_contract_id = bf01.mss_sett_contract_id and bf01.mss_sett_contract_id = bf06.mss_sett_contract_id and bf06.MSS_SC_ACC_RECV_ID = bt01.mss_sc_acc_recv_id and bt01.OVERDUED = '1' and bf01.NOTE_STATE = 2 and ac03.STATUS = '4' and not (bt01.AR_STATUS = '2') and bf01.scc_company_id = aging.scc_company_id and bf01.SETTLE_TYPE_NO = aging.SETTLE_TYPE_NO and to_char(trunc(ACC_RECV_DATE), 'yyyy-mm') = to_char(add_months(trunc(sysdate), -1), 'yyyy-mm') and months_between(sysdate, ACC_RECV_DATE) <= 12 and months_between(sysdate, ACC_RECV_DATE) >= 6 group by bf01.scc_company_id, bf01.SETTLE_TYPE_NO; EXCEPTION WHEN NO_DATA_FOUND THEN overdue2 := 0; end; begin select sum(bt01.AR_AMOUNT) into overdue3 from TB_MSS_SETT_CONTRACT bf01, TB_MSS_SC_ACC_RECV_DET bf06, TB_MSS_SETT_INVOICE bf02, TB_SCC_WF_PROC_MAIN ac03, TB_MSS_SC_ACC_RECV bt01 where ac03.target_table_name = 'TB_MSS_SETT_INVOICE' and ac03.target_table_id = bf02.mss_sett_invoice_id and bf02.mss_sett_contract_id = bf01.mss_sett_contract_id and bf01.mss_sett_contract_id = bf06.mss_sett_contract_id and bf06.MSS_SC_ACC_RECV_ID = bt01.mss_sc_acc_recv_id and bt01.OVERDUED = '1' and bf01.NOTE_STATE = 2 and ac03.STATUS = '4' and not (bt01.AR_STATUS = '2') and bf01.scc_company_id = aging.scc_company_id and bf01.SETTLE_TYPE_NO = aging.SETTLE_TYPE_NO and to_char(trunc(ACC_RECV_DATE), 'yyyy-mm') = to_char(add_months(trunc(sysdate), -1), 'yyyy-mm') and months_between(sysdate, ACC_RECV_DATE) <= 18 and months_between(sysdate, ACC_RECV_DATE) >= 12 group by bf01.scc_company_id, bf01.SETTLE_TYPE_NO; EXCEPTION WHEN NO_DATA_FOUND THEN overdue3 := 0; end; begin select sum(bt01.AR_AMOUNT) into overdue4 from TB_MSS_SETT_CONTRACT bf01, TB_MSS_SC_ACC_RECV_DET bf06, TB_MSS_SETT_INVOICE bf02, TB_SCC_WF_PROC_MAIN ac03, TB_MSS_SC_ACC_RECV bt01 where ac03.target_table_name = 'TB_MSS_SETT_INVOICE' and ac03.target_table_id = bf02.mss_sett_invoice_id and bf02.mss_sett_contract_id = bf01.mss_sett_contract_id and bf01.mss_sett_contract_id = bf06.mss_sett_contract_id and bf06.MSS_SC_ACC_RECV_ID = bt01.mss_sc_acc_recv_id and bt01.OVERDUED = '1' and bf01.NOTE_STATE = 2 and ac03.STATUS = '4' and not (bt01.AR_STATUS = '2') and bf01.scc_company_id = aging.scc_company_id and bf01.SETTLE_TYPE_NO = aging.SETTLE_TYPE_NO and to_char(trunc(ACC_RECV_DATE), 'yyyy-mm') = to_char(add_months(trunc(sysdate), -1), 'yyyy-mm') and months_between(sysdate, ACC_RECV_DATE) <= 24 and months_between(sysdate, ACC_RECV_DATE) >= 18 group by bf01.scc_company_id, bf01.SETTLE_TYPE_NO; EXCEPTION WHEN NO_DATA_FOUND THEN overdue4 := 0; end; begin select sum(bt01.AR_AMOUNT) into overdue5 from TB_MSS_SETT_CONTRACT bf01, TB_MSS_SC_ACC_RECV_DET bf06, TB_MSS_SETT_INVOICE bf02, TB_SCC_WF_PROC_MAIN ac03, TB_MSS_SC_ACC_RECV bt01 where ac03.target_table_name = 'TB_MSS_SETT_INVOICE' and ac03.target_table_id = bf02.mss_sett_invoice_id and bf02.mss_sett_contract_id = bf01.mss_sett_contract_id and bf01.mss_sett_contract_id = bf06.mss_sett_contract_id and bf06.MSS_SC_ACC_RECV_ID = bt01.mss_sc_acc_recv_id and bt01.OVERDUED = '1' and bf01.NOTE_STATE = 2 and ac03.STATUS = '4' and not (bt01.AR_STATUS = '2') and bf01.scc_company_id = aging.scc_company_id and bf01.SETTLE_TYPE_NO = aging.SETTLE_TYPE_NO and to_char(trunc(ACC_RECV_DATE), 'yyyy-mm') = to_char(add_months(trunc(sysdate), -1), 'yyyy-mm') and months_between(sysdate, ACC_RECV_DATE) >= 24 group by bf01.scc_company_id, bf01.SETTLE_TYPE_NO; EXCEPTION WHEN NO_DATA_FOUND THEN overdue5 := 0; end; insert into TB_MSS_AGENCY_OD_AGING (MSS_AGENCY_OD_AGING_ID, SCC_COMPANY_ID, YEAR_MONTH, SETTLE_TYPE_NO, UN_DUE_AMOUNT, OD_6_MONTHS, OD_12_MONTHS, OD_18_MONTHS, OD_24_MONTHS, OD_2_YEARS, OD_SUMMARY) values (sq_mss_agency_od_aging.NEXTVAL, aging.scc_company_id, to_char(add_months(trunc(sysdate), -1), 'yyyy-mm'), aging.SETTLE_TYPE_NO, amount, overdue1, overdue2, overdue3, overdue4, overdue5, overdue1 + overdue2 + overdue3 + overdue4 + overdue5); end loop; end; end SP_MSS_AGING;
2014年10月30日 18:25
目前还没有答案
相关推荐
在传统的Excel环境中,每次只能单独计算一个DMU的效率,而MATLAB编程则可以批量处理所有DMU的数据,极大地提高了计算效率。MATLAB中的线性规划求解器是实现这一目标的关键工具。 MATLAB通过内置的优化工具箱提供了...
迷宫通常被表示为一个二维网格,其中每个格子代表一个节点,节点之间通过边相连。在8个方向的迷宫中,一个节点不仅可以上下左右移动,还能前后斜向移动,即东北、东南、西北、西南四个方向。这样的设定增加了路径的...
在这个"Matlab 求解超效率DEA的程序"中,可能包含了一个完整的MATLAB脚本或函数,用于实现超效率DEA的计算过程。这个程序可能包括以下关键步骤: 1. 数据预处理:DEA模型依赖于输入和输出的数据集。首先,你需要...
在数学规划领域,非线性优化是寻找一个函数的最小值或最大值,其中至少有一个变量与目标函数的关系不是线性的。Ipopt采用内点法策略,这是一种在优化领域广泛应用的算法,它通过迭代逐步接近问题的最优解。 Ipopt的...
本文主要介绍了使用汇编语言设计一个程序,求解一元二次方程 ax2+bx+x=0。该程序可以从键盘输入a,b,c的值,并显示方程的解。考虑所有的情况,包括共轭复根。在设计过程中,需要进行方案比较和认证、系统原理阐述、...
写一个完整的8086汇编语言程序,求解表达式-3x-y+1的值,结果显示在屏幕上
在计算机科学中,华容道的求解问题是一个典型的路径搜索问题,可以通过编程解决。本文将深入探讨使用C语言实现华容道求解的高效算法,以及涉及的数据结构和内存管理。 一、C语言基础 C语言是一种强大的、高效的编程...
通过上述步骤,EXCEL规划求解功能不仅解决了复杂优化问题,还帮助科罗拉多牛公司节省了成本,提高了饲料配方的效率和效益。 综上所述,EXCEL规划求解功能是解决优化问题的利器,其强大的灵活性和广泛的应用场景使其...
ECOS求解器使用内点法,这是一种强大的算法,可以处理大规模的优化问题,并且在计算效率和内存使用上都有优秀的表现。 在C++编程环境中,我们可以利用ECOS的C接口来构建和求解二阶锥问题。ECOS的C++接口提供了一个...
同时,为了避免重复探索已经访问过的节点,还需要使用一个二维数组或哈希表来记录状态。 在给定的“迷宫求解”压缩包文件中,可能包含了一个迷宫求解程序的源代码,可能是用Python、C++、Java或其他编程语言实现的...
在Java编程语言中,求解一元n次方程是一个涉及数值分析和数学计算的问题。一元n次方程指的是只含有一个变量的最高次幂为n的方程,如一般的n次多项式方程: \[ ax^n + bx^{n-1} + cx^{n-2} + \ldots + z = 0 \] ...
数独(Sudoku)是一种逻辑填数字游戏,玩家需按照一定的规则在9×9的网格内填入1至9的数字,使得每一行、每一列以及每一个3×3的小宫格内的数字都不重复。数独游戏不仅能够锻炼人的逻辑思维能力,还能提高解决问题的...
总结来说,水壶问题是一个经典的逻辑问题,它在人工智能领域中被用来训练和测试搜索算法的有效性和效率。理解和解决这个问题,有助于提升我们在面对实际生活中资源有限、步骤受限的问题时的思维能力和解决问题的能力...
在每个迭代步中,SNOPT会构建一个二次模型,该模型尽可能地逼近当前问题的局部几何特性,然后通过求解这个二次模型来确定下一个迭代点。这个过程会不断重复,直到满足停止准则,如满足精度要求、达到最大迭代次数...
2. **编程示例**:在Python中,可以创建一个优化任务对象,输入系数,定义变量类型,然后调用`solve`方法求解。API提供了丰富的错误处理和日志记录功能,便于调试和问题定位。 3. **高级功能**:除了基本的求解功能...
总之,Excel的规划求解插件SOLVER是一个强大的分析工具,它能够帮助用户在复杂的问题环境中找到最佳解决方案。熟练掌握其使用方法,对于提升数据分析和决策能力具有重要意义。通过实践和学习,用户可以将SOLVER应用...
matlab基于求解器intlinprog求解52城市TSP...这意味着找到的最优解并没有给出一条穿过所有点的连续路径,而是有几个独立的环路。然后,你可以使用迭代过程来确定子回路,添加约束,并重新运行优化,直到消除子回路。
在这个问题中,我们通常将迷宫视为一个二维矩阵,其中每个节点代表一个位置,而路径则由可通行的节点(通常是1或true)表示,墙壁或其他障碍物则用不可通行的节点(通常是0或false)表示。本项目是用C语言编写的一个...
迷宫寻路问题是在以方格表示的地图场景中,对于给定的起点、终点和障碍物(墙),如何找到一条从起点开始避开障碍物到达终点的最短路径。 以寻路问题为例实现A昇法的水解程序(编程语言不限),要求设计两种不同的估价函数...
在计算机科学领域,迷宫求解问题是一个经典的图论问题,常常被用来考察算法设计和数据结构的应用。本文将深入探讨如何使用C语言和堆栈数据结构来解决此类问题。 首先,我们需要理解迷宫的基本概念。迷宫通常表示为...