G-4380 Try to label your EXIT WHEN statements.

Minor

Maintainability

Reason

It's a good alternative for comments, especially for nested loops to name the loop to exit.

Example (bad)

DECLARE
   co_init_loop  CONSTANT SIMPLE_INTEGER           := 0;
   co_increment  CONSTANT SIMPLE_INTEGER           := 1;
   co_exit_value CONSTANT SIMPLE_INTEGER           := 3;
   co_outer_text CONSTANT types_up.short_text_type := 'Outer Loop counter is ';
   co_inner_text CONSTANT types_up.short_text_type := ' Inner Loop counter is ';
   l_outerlp PLS_INTEGER;
   l_innerlp PLS_INTEGER;
BEGIN
   l_outerlp := co_init_loop;
   <<outerloop>>
   LOOP
      l_innerlp := co_init_loop;
      l_outerlp := NVL(l_outerlp,co_init_loop) + co_increment;
      <<innerloop>>
      LOOP
         l_innerlp := NVL(l_innerlp, co_init_loop) + co_increment;
         sys.dbms_output.put_line(co_outer_text || l_outerlp ||
                                  co_inner_text || l_innerlp);

         EXIT WHEN l_innerlp = co_exit_value;
      END LOOP innerloop;

      EXIT WHEN l_innerlp = co_exit_value;
   END LOOP outerloop;
END;
/

Example (good)

DECLARE
   co_init_loop  CONSTANT SIMPLE_INTEGER           := 0;
   co_increment  CONSTANT SIMPLE_INTEGER           := 1;
   co_exit_value CONSTANT SIMPLE_INTEGER           := 3;
   co_outer_text CONSTANT types_up.short_text_type := 'Outer Loop counter is ';
   co_inner_text CONSTANT types_up.short_text_type := ' Inner Loop counter is ';
   l_outerlp PLS_INTEGER;
   l_innerlp PLS_INTEGER;
BEGIN
   l_outerlp := co_init_loop;
   <<outerloop>>
   LOOP
      l_innerlp := co_init_loop;
      l_outerlp := NVL(l_outerlp,co_init_loop) + co_increment;
      <<innerloop>>
      LOOP
         l_innerlp := NVL(l_innerlp, co_init_loop) + co_increment;
         sys.dbms_output.put_line(co_outer_text || l_outerlp ||
                                  co_inner_text || l_innerlp);

         EXIT outerloop WHEN l_innerlp = co_exit_value;
      END LOOP innerloop;
   END LOOP outerloop;
END;
/