Download PL/SQL User's Guide and Reference

Transcript
EXIT Statement
EXIT;
END IF;
END;
-- not allowed; use RETURN instead
The following loop normally executes ten times, but it will exit prematurely if there are
less than ten rows to fetch:
FOR i IN 1..10 LOOP
FETCH c1 INTO emp_rec;
EXIT WHEN c1%NOTFOUND;
total_comm := total_comm + emp_rec.comm;
END LOOP;
The following example illustrates the use of loop labels:
<<outer>>
FOR i IN 1..10 LOOP
...
<<inner>>
FOR j IN 1..100 LOOP
...
EXIT outer WHEN ...
END LOOP inner;
END LOOP outer;
-- exits both loops
Related Topics
Expressions, LOOP Statements
PL/SQL Language Elements
13-51