While loop is an another looping structure. It is also called conditional loop. It evaluates the condition before each iteration executes. While loop is effective when how number of iterations are not known prior to the execution.
—- your code here
1) Print all odd numbers less than 10
SQL> set serveroutput on
2 n integer;
4 n := 1;
5 while n <= 10 loop
7 n := n + 2;
8 end loop;
PL/SQL procedure successfully completed.
Note that if we omit the condition n := n + 2 then while loop will fall in infinite loop.
So always be cautious when constructing a while loop.