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;
就像这种对同一个标志位打符号的语句,怎么简化,,存储过程我没有系统的学过,有没有什么推荐看的资料,谢谢了