oracle中如何写update语句
发布网友
发布时间:2022-04-08 03:47
我来回答
共1个回答
热心网友
时间:2022-04-08 05:17
--定义游标sms_send_cur,使用游标型for循环遍历sms_send_cur获取记录,最后根据要求执行相应的更新操作。
declare
cursor ssm_send_cur is
select *
from sms_send_wait ssw left join sms_send_receive ssr on ssr.sms_id = ssw.sms_id
where not exists
(select ssrb.phone_number
from sms_send_receive_blacklist ssrb
where ssrb.phone_number=ssw.phone_number) and ssw.send_wait_time between sysdate-1 and sysdate+1
begin
--循环获取游标中的记录
for sms_send_rec in sms_send_cur
loop
update sms_send_wait ssw set ssw.verify_state = '0'
where ssw.pbone_number = sms_send_rec.phone_number;
end loop;
end;