Database Reference
In-Depth Information
BEGIN
WHILE STEP < 10 LOOP
DBMS_OUTPUT.PUT_LINE(TO_CHAR(STEP));
STEP := STEP + 1;
END LOOP;
END;
/
Note: Note the presence of the counter (STEP := STEP + 1) in the WHILE
loop example. A FOR loop counts automatically.
24.7.2.3
The LOOP...END LOOP Construct
This loop is usually called the Infinite Loop and is the simplest of all the
looping constructs. The EXIT WHEN clause is used to abort the loop from
anywhere within that loop. The syntax for the LOOP…END LOOP con-
struct is shown in Figure 24.20.
Figure 24.20
LOOP ... END
LOOP Statement
Syntax.
The following example counts forward from 1 to 5. An example screen-
shot is not included for this LOOP…END LOOP example.
DECLARE
STEP INTEGER DEFAULT 1;
BEGIN
Search WWH ::




Custom Search