2、oracle的while循环

发布时间 2023-12-22 16:42:10作者: 站着说话不腰疼

oracle的while循环

1、语法

while [condition] loop
[execute]
end loop;

2、使用

v_count := 1;
--当查询的条件数量为0时自动跳出while循环
while v_count >0 loop
	select count(1) into v_count from t_tab where task_status = '0';
	update t_tab 
	set task_status = '1'
	where task_status = '0' 
	 FETCH NEXT 500 ROWS ONLY;
end loop;