开始
DECLARE v_lower NUMBER :=1; v_upper NUMBER :=10; BEGIN FOR i IN v_lower .. v_upper LOOP dbms_output.put_line('i is: '|| i); END LOOP; END;
要注意,i 并没有进行事前定义。运行的结果是:
anonymous block completed i is: 1 i is: 2 i is: 3 i is: 4 i is: 5 i is: 6 i is: 7 i is: 8 i is: 9 i is: 10
结束