xiangyanglyz 2017-05-18 09:45 采纳率: 63.6%
浏览 741

oracle 存储过程相关的简化问题,

update km_boss_compare k
set k.comparea_all = 1
where exists (select *
from bb_phone_card_info_t t
where if_valid = 1
and order_status = '成功'
and t.service_id = k.phone_number
and t.imsi = k.imsi
and t.card_no = k.iccid)
and to_char(k.time, 'yyyymmdd') = today
and k.node = 1;
commit;

update km_boss_compare k
set k.comparea_all = -1
where not exists (select *
from bb_phone_card_info_t t
where if_valid = 1
and order_status = '成功'
and t.service_id = k.phone_number
and t.imsi = k.imsi
and t.card_no = k.iccid)
and to_char(k.time, 'yyyymmdd') = today
and k.node = 1;
commit;
就像这种对同一个标志位打符号的语句,怎么简化,,存储过程我没有系统的学过,有没有什么推荐看的资料,谢谢了

  • 写回答

1条回答 默认 最新

  • sunshine_0518 2017-05-19 02:06
    关注

    update km_boss_compare k
    set k.comparea_all =

    case when exists (select *
    from bb_phone_card_info_t t
    where if_valid = 1
    and order_status = '成功'
    and t.service_id = k.phone_number
    and t.imsi = k.imsi
    and t.card_no = k.iccid)
    and to_char(k.time, 'yyyymmdd') = today
    and k.node = 1
    then 1
    else then -1 end;
    commit;

    评论

报告相同问题?

悬赏问题

  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致