Question: Given a function named 2 in Figure 2a and an anonymous block in Figure 2b, change and rewrite the basic loop in Figure 2a to

 Given a function named 2 in Figure 2a and an anonymous

Given a function named 2 in Figure 2a and an anonymous block in Figure 2b, change and rewrite the basic loop in Figure 2a to a while loop. The expected results are given in Figure 2e. 1 CREATE OR REPLACE FUNCTION Q2 (IN NUMBER, a OUT NUMBER) 2 RETURN VARCHAR2 3 IS 4 total NUMBER :- 11; 5 msg VARCHAR2(30); 6 7 BEGIN a bi 9 LOOP 10 total - total + a 11 12 DBMS_OUTPUT.PUT_LINE (Total is 'Il total) 13 EXIT WHEN a > 7; 14 END LOOP; 15 msg :- 'Total is :'lla; 16 return mag 17 END; Figure 2a : Function 2 SET SERVEROUTPUT ON; DECLARE a NUMBER := 6; b VARCHAR2 (30) BEGIN b: 93(2, a); DBMS_OUTPUT.PUT_LINE (b); DBMS_OUTPUT.PUT_LINE ('The value of b : '); END; Figure 2b : Anonymous Block Function created. Total is : 13 Total is : 17 Total is : 23 Total is : 8 The value of b: 8 PL/SQL procedure successfully completed. Figure 2c. Expected Results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!