SQL>
SQL> --WHILE loop
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 x NUMBER := 1;
3 BEGIN
4 WHILE x <= 5 LOOP
5 DBMS_OUTPUT.PUT_LINE('This has executed' ||TO_CHAR(x)||' time(s)');
6 x := x +1;
7 END LOOP;
8 END;
9 /
This has executed1 time(s)
This has executed2 time(s)
This has executed3 time(s)
This has executed4 time(s)
This has executed5 time(s)
PL/SQL procedure successfully completed.
SQL>
SQL>