EXIT WHEN

EXIT WHEN example

  
DECLARE 
	v_num NUMBER:=0;
BEGIN
	LOOP 
		v_num:=v_num+1;
		DBMS_OUTPUT.put_line(v_num);
		EXIT WHEN v_num = 5 ;
	END LOOP;
END;

Output:

1
2
3
4
5