The syntax for the FOR Loop is:
FOR loop_counter IN [REVERSE] lowest_number..highest_number
LOOP
{.statements.}
END LOOP;
You would use a FOR Loop when you want to execute the loop body a fixed number of times.
Let's take a look at an example.
FOR Lcntr IN 1..20
LOOP
LCalc := Lcntr * 31;
END LOOP;
This example will loop 20 times. The counter will start at 1 and end at 20.
The FOR Loop can also loop in reverse. For example:
FOR Lcntr IN REVERSE 1..15
LOOP
LCalc := Lcntr * 31;
END LOOP;
This example will loop 15 times. The counter will start at 15 and end at 1. (loops backwards)
'개발' 카테고리의 다른 글
RSS 문서 제작을 위한 RSS 규약의 이해 (RSS 2.0) (0) | 2010.10.12 |
---|---|
[DB] 오라클(oracle) 락(lock) 확인 및 제거(kill) (11) | 2010.10.01 |
[DB] SQL*Loader FAQ(bulk insert) (11) | 2010.09.10 |
[DB] 오라클(Oracle) SQL Loader사용방법(bulk insert) (0) | 2010.09.10 |
[DB] 토드(Toad)에서 RefCurosr 실행 예시(sample) (0) | 2010.09.10 |