After this Lab, you will be able to:
You have explored three types of loops: simple loops, WHILE loops, and numeric FOR loops. Any of these three types of loops can be nested inside one another. For example, a simple loop can be nested inside a WHILE loop and vice versa. Consider the following example:
▪ FOR EXAMPLE
DECLARE v_counter1 INTEGER := 0; v_counter2 INTEGER; BEGIN WHILE v_counter1 < 3 LOOP DBMS_OUTPUT.PUT_LINE ('v_counter1: '||v_counter1); v_counter2 := 0; LOOP DBMS_OUTPUT.PUT_LINE ('v_counter2: '||v_counter2); v_counter2 := v_counter2 + 1; EXIT WHEN v_counter2 >= 2; END LOOP; v_counter1 := v_counter1 + 1; END LOOP; END;
In this example, the WHILE loop is called an outer loop ...