Q:

Write a program in PL/SQL using nested loop with EXIT WHEN statement

0

Write a program in PL/SQL using nested loop with EXIT WHEN statement.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

PL/SQL Code:

DECLARE
  m PLS_INTEGER := 0;
  n PLS_INTEGER := 0;
 
BEGIN
  LOOP
    m := m + 1;
    DBMS_OUTPUT.PUT_LINE ('The value of m = ' || m);
    
    LOOP
      n := n + 1;
      DBMS_OUTPUT.PUT_LINE ('The value of n = ' || n);
      EXIT WHEN (n > 4);
    END LOOP;
 
    DBMS_OUTPUT.PUT_LINE ('Exited inner loop');
 
    EXIT WHEN (m > 3);
  END LOOP;
 
  DBMS_OUTPUT.PUT_LINE ('Exited outer loop');
END;
/

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now