标签:
1. Framework.QueryInfo info1 = new Framework.QueryInfo();
//string Sql = Holworth.Utility.Utility.EntityRowMapper.getSql("//data//ValueAtRiskCalculationService//NoneQuery2");
//info.CustomSQL = Sql;
info1.NamedQuery = "P_TRAN_SIMULATION1";
info1.Parameters.Add("v_ComputeDate1", DateTime.Parse("2015/3/9"));
info1.Parameters.Add("v_ComputeDate2", DateTime.Parse("2015/6/9"));
Dao.ExecuteNonQuery(info1);
2.
create or replace procedure P_TRAN_SIMULATION1
(
v_ComputeDate1 in date,
v_ComputeDate2 in date
)is
begin
declare cashflowPOSITIVE NUMBER:=0;
cashflowNEGATIVE NUMBER:=0;
cursor mycur is
select *
from TRAN_CASH_FLOW
where as_of_date = v_ComputeDate1
and payment_date >=v_ComputeDate1
and payment_date < v_ComputeDate2;
cashFlowRow TRAN_CASH_FLOW%rowtype;
begin
open mycur; --打开游标
loop
fetch mycur into cashFlowRow; --把游标所指的纪录放到变量中
exit when (mycur%notfound); --当游标没有指向行时退出循环
if cashFlowRow.cashflow_value>0 then
cashflowPOSITIVE:=cashflowPOSITIVE+cashFlowRow.cashflow_value;
else
cashflowNEGATIVE:=cashflowNEGATIVE+cashFlowRow.cashflow_value;
end if;
end loop;
-- dbms_output.put_line(cashflowPOSITIVE);
close mycur; --关闭游标
insert into tbl values(cashflowPOSITIVE,cashflowPOSITIVE);
end;
end P_TRAN_SIMULATION1;
标签:
原文地址:http://www.cnblogs.com/kexb/p/4462160.html