Home > database >  T - SQL stored procedure
T - SQL stored procedure

Time:10-10

The great god, now in order to realize function code following zha to cursor or function such as written?
The create or replace procedure pro_unicom_pay2 is
The begin
The update unicom_midtab1 a
The set of GPRS=
(select GPRS
The from unicom_midtab2 b
Where Anderson:=b.i:
And to_number (b.g PRS) & lt;> 0.00),
IP=
(select IP from unicom q where q.i ccid=Anderson, ccid);
commit;

Insert into sim_expense
(sim, the month, expense, isp, yjbf, GPRS, iccid, traffic, IP)
(select b.s im,
B.m onth,
(b.y JBF + NVL (b.g PRS, 0)),
B.i sp,
B.y JBF,
B.g PRS,
B.i ccid. B.t raffic,
B.i p
The from unicom_midtab1 b);
commit;
End pro_unicom_pay2;

Probably is inserted to the sim_expense list data, but fields from different tables and fields are the other two fields together, turning the cursor variable that kind of writing

CodePudding user response:

Use excel to draw your original data, and expected results, also want to describe the calculation process,

CodePudding user response:

refer to the original poster myaxp response:
great god, now in order to realize function code following zha to cursor or function such as written?
The create or replace procedure pro_unicom_pay2 is
The begin
The update unicom_midtab1 a
The set of GPRS=
(select GPRS
The from unicom_midtab2 b
Where Anderson:=b.i:
And to_number (b.g PRS) & lt;> 0.00),
IP=
(select IP from unicom q where q.i ccid=Anderson, ccid);
commit;

Insert into sim_expense
(sim, the month, expense, isp, yjbf, GPRS, iccid, traffic, IP)
(select b.s im,
B.m onth,
(b.y JBF + NVL (b.g PRS, 0)),
B.i sp,
B.y JBF,
B.g PRS,
B.i ccid. B.t raffic,
B.i p
The from unicom_midtab1 b);
commit;
End pro_unicom_pay2;

Probably is inserted to the sim_expense list data, but fields from different tables and fields are the other two fields together, turning the cursor variable that writing


The original poster wrote does not seem like t-sql syntax, like oracle, cursors and process, can refer to the following posts:
https://www.cnblogs.com/aotian56/archive/2007/07/13/817281.html
https://www.cnblogs.com/xishuai/p/3372754.html
  • Related