Write a program in PL/SQL to print the value of a variable inside and outside a loop using LOOPEXIT statement.
DECLARE
n NUMBER := 0;
BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE ('The value of n inside the loop is: ' || TO_CHAR(n));
n := n + 1;
IF n > 5 THEN
EXIT;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE('The value of n outside the loop is: ' || TO_CHAR(n));
END;
/
Comments
Leave a comment