alter PROCEDURE [dbo].[sp_gongzi] @gongzi_yf varchar(7) as
DECLARE @input_id varchar(20)
DECLARE @sk_sum decimal(18, 3)
DECLARE @sk_sum_yk decimal(18, 3)
BEGIN
DECLARE cur_input CURSOR FOR
select docno from tc_tab1 where yf = @gongzi_yf
OPEN cur_input
FETCH cur_input INTO @input_id
WHILE @@FETCH_STATUS = 0
BEGIN
set @sk_sum = 0
set @sk_sum_yk = 0
select @sk_sum = sum(je * case when (hl2 is null) then hl else hl2 end )
from sk_dan where docno =@input_id;
select @sk_sum_yk = sum(je * case when (hl2 is null) then hl else hl2 end )
from sk_dan_yk where docno =@input_id;
set @sk_sum = case when (@sk_sum is null) then 0 else @sk_sum end;
set @sk_sum_yk = case when (@sk_sum_yk is null) then 0 else @sk_sum_yk end;
update tc_tab1 set dke2 = @sk_sum + @sk_sum_yk
where docno = @input_id;
FETCH cur_input INTO @input_id
END
CLOSE cur_input
DEALLOCATE cur_input
--*/
END
相关文章
- 如何在速度模板中的for循环内为div生成唯一的类名?
- requirejs加载bootstrap报错处理:Bootstrap dropdown require Popper.js (https://popper.js.org)
- 处理Angular报错:ERROR in Metadata version mismatch for module
- 【Spring原理分析-Bean生命周期+Spring原理分析-Bean后处理器】
- Pytorch深度学习实战3-7:详解数据加载DataLoader与模型处理
- BeanShell处理返回报文写一个TXT文档
- 基于国产车规级处理器T507-H开发平台,如何用50行Python代码实现图传和人脸识别?
- 处理蓝牙BLE MESH消息的网络风暴
- SqlServer(八)获取表的所有字段属性
- ansible中字符串处理