8.2.1 Use WHILE LoopsIn this exercise, you will use a WHILE loop to calculate the sum of the integers between 1 and 10. Create the following PL/SQL script: -- ch08_3a.sql, version 1.0 SET SERVEROUTPUT ON DECLARE v_counter BINARY_INTEGER := 1; v_sum NUMBER := 0; BEGIN WHILE v_counter <= 10 LOOP v_sum := v_sum + v_counter; DBMS_OUTPUT.PUT_LINE ('Current sum is: 'v_sum); -- increment loop counter by one v_counter := v_counter + 1; END LOOP; -- control resumes here DBMS_OUTPUT.PUT_LINE ('The sum of integers between 1 ' 'and 10 is: 'v_sum); END; Execute the script, and then answer the following questions:
|