没有降序,只能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;
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;
解决方案 »
- 替代值问题
- 脱机数据怎么同步?
- 计算电量得问题?要求在数据库中处理计算逻辑并返回结果
- ORACLE与SQLSERVER问题
- pro*c EXEC SQL select 1 from aaa 表aaa中有2行一样的数据,为什么会报错呢
- 获取当前日期的问题
- 救命啊!! blob问题,怎么向blob字段插入数据! 救命……
- oracle9i 的init文件为什么是 init.ora+日期 ?
- 我有两个装了win2000 专业版与服务器版操作系统的机器,why oracle(client or server)不能装?双击安装图标没提示也没反应?
- 关于数据库导入报错
- 一个菜鸟问题!
- 请教一下oracle存储过程中拆分字符串的函数?
for i in reverse 1..100
loop
null;
end loop;
没见过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;