砖猿xiuvee 2016-12-22 02:54 采纳率: 0%
浏览 1735

ORACLE存储过程update不了也不报错,请大神帮帮忙

存储过程如下,出不来计算数据,查了一下发下Update操作没有更新,也不报错,有点急

 PROCEDURE update_marketing_moneys AS
    --根据佣金表里获取当月数据
    CURSOR p_fycDetail_list IS

      select sum(y.FYC_Money) as fyc_moneys,
             info.pid,
             info.profession_level,
             nvl(y.intro_platform, 'cfy') as intro_platform

        from is_crm_trade_audit_fyc y, v_store_userinfo info
       where y.count_status = '1'
         and y.confirm_grant_status = '1' --是否待发放
         and y.expect_time = to_char(sysdate, 'yyyy-MM') || '-25'
         and y.ins_parent_pid = info.pid
         and y.owner_channel_type <> '3'

       group by info.pid, info.profession_level, y.intro_platform;

  BEGIN
    FOR p_fyc IN p_fycDetail_list LOOP

      IF p_fyc.fyc_moneys > 1000 THEN
        BEGIN
          --更新行销津贴
          UPDATE is_crm_commission_fyc_grant g
             SET g.marketing_rate  = nvl((select nvl(r.rule_coefficient, '0')
                                           from is_crm_commission_rule r
                                          where r.rule_type = '4'
                                            and r.rule_sub_type =
                                                p_fyc.profession_level
                                            and r.rule_data_begin <=
                                                p_fyc.fyc_moneys
                                            and r.rule_data_end >
                                                p_fyc.fyc_moneys),
                                         '0.15'),
                 g.marketing_money = nvl((select nvl(r.rule_coefficient, '0')
                                           from is_crm_commission_rule r
                                          where r.rule_type = '4'
                                            and r.rule_sub_type =
                                                p_fyc.profession_level
                                            and r.rule_data_begin <=
                                                p_fyc.fyc_moneys
                                            and r.rule_data_end >
                                                p_fyc.fyc_moneys),
                                         '0.15') * g.fyc_moneys
           where g.store_pid = p_fyc.pid
             and g.intro_platform = p_fyc.intro_platform
             and g.expect_time = to_char(sysdate, 'yyyy-MM') || '-25';

          COMMIT;
        EXCEPTION

          WHEN OTHERS THEN

            UPDATE is_crm_commission_fyc_grant g
               SET g.marketing_rate  = '0.15',
                   g.marketing_money = '0.15' * g.fyc_moneys
             where g.store_pid = p_fyc.pid
               and g.intro_platform = p_fyc.intro_platform
               and g.expect_time = to_char(sysdate, 'yyyy-MM') || '-25';

        END;
        COMMIT;
      END IF;
    END LOOP;
    --如果没有级别则默认为15%的fyc金额
    UPDATE is_crm_commission_fyc_grant g
       SET g.marketing_rate  = '0.15',
           g.marketing_money = '0.15' * g.fyc_moneys
     where g.profession_level is null
       and to_number(g.fyc_moneys) >= 1000
       and g.owner_channel_type <> '3'
       and g.grant_satus = '0';
  END;
  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2016-12-22 03:54
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥60 SOL语句中Where查询中的 from to 语句能不能从小到大换成从大到小(标签-SQL)
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 请教一下c语言的代码里有一个地方不懂
  • ¥15 opencv 无法读取视频
  • ¥15 用matlab 实现通信仿真
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))