# G-4395: Avoid hard-coded upper or lower bound values with FOR loops.

Minor

Changeability, Maintainability

## Reason

Your LOOP statement uses a hard-coded value for either its upper or lower bounds. This creates a "weak link" in your program because it assumes that this value will never change. A better practice is to create a named constant (or function) and reference this named element instead of the hard-coded value.

BEGIN
<<for_loop>>
FOR i IN 1..5
LOOP
sys.dbms_output.put_line(i);
END LOOP for_loop;
END;
/


## Example (good)

DECLARE
co_lower_bound CONSTANT SIMPLE_INTEGER := 1;
co_upper_bound CONSTANT SIMPLE_INTEGER := 5;
BEGIN
<<for_loop>>
FOR i IN co_lower_bound..co_upper_bound
LOOP
sys.dbms_output.put_line(i);
END LOOP for_loop;
END;
/