没有降序,只能1..10,不能1...10或10..1关于步长可以这样处理,没有设置的地方的
FOR loop_index IN 1 .. 100
LOOP
   IF MOD (loop_index, 2) = 0
   THEN
      /* We have an even number, so perform calculation */
      calc_values (loop_index);
   END IF;
END LOOP;

解决方案 »

  1.   

    但为什么在plsql中能使用1...10(虽然结果是跳过,但没有出错).
      

  2.   

    --递减循环
      for i in reverse 1..100
      loop
        null;
      end loop;
      

  3.   

    Question 1:
      没见过1...10这种写法。
    Question 3:Some languages provide a STEP clause, which lets you specify a different increment
    (5 instead of 1 for example). PL/SQL has no such structure, but you can easily build
    one. Inside the FOR loop, simply multiply each reference to the loop counter by the
    new increment. In the following example, you assign today’s date to elements 5, 10,
    and 15 of an index-by table:DECLARE
      TYPE DateList IS TABLE OF DATE INDEX BY BINARY_INTEGER;
      dates DateList;
      k CONSTANT INTEGER := 5; -- set new increment
    BEGIN
      FOR j IN 1..3 LOOP
        dates(j*k) := SYSDATE; -- multiply loop counter by increment
      END LOOP;
    ...
    END;