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; --Open cursor
Loop
Fetch mycur into Cashflowrow; --Place the record indicated by the cursor in the variable
Exit when (Mycur%notfound); --Exits the loop when the cursor does not point to a row
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; --Close cursor
INSERT into TBL values (cashflowpositive,cashflowpositive);
End
End P_tran_simulation1;
Oracle stored procedures combined with my company code 1