The lower and upper bounds of a FOR LOOP statement can be either numeric literals, numeric variables, or numeric expressions.
If a bound does not have a numeric value, then PL/SQL raises the predefined exception VALUE_ERROR.
SQL> SQL> DECLARE-- www. ja v a 2 s .co m 2 first INTEGER := 1; 3 last INTEGER := 10; 4 high INTEGER := 100; 5 low INTEGER := 12; 6 BEGIN 7 -- Bounds are numeric literals: 8 FOR j IN -5..5 LOOP 9 NULL; 10 END LOOP; 11 12 -- Bounds are numeric variables: 13 FOR k IN REVERSE first..last LOOP 14 NULL; 15 END LOOP; 16 17 -- Lower bound is numeric literal, 18 -- Upper bound is numeric expression: 19 FOR step IN 0..(TRUNC(high/low) * 2) LOOP 20 NULL; 21 END LOOP; 22 END; 23 / PL/SQL procedure successfully completed. SQL>