Exit a loop with condition
SQL> SQL> SET ECHO ON SQL> SQL> DECLARE 2 v_MyNumber NUMBER := 0; 3 BEGIN 4 LOOP 5 IF v_MyNumber > 7 THEN 6 EXIT; 7 ENd if; 8 v_MyNumber := v_MyNumber + 1; 9 END LOOP; 10 END; 11 / PL/SQL procedure successfully completed. SQL> SQL> SQL> SQL> --