FOR Loops

Oracle has another powerful looping structure that we have not seen: the FOR loop. There are a number of variations of this structure, the simplest of which is the numeric FOR loop. The most sophisticated and powerful is the cursor FOR loop. This section will discuss the various versions of this looping structure.

Numeric FOR Loops

The chief characteristic of a numeric FOR loop is that it contains a counting variable. This variable is used to determine when the focus should move from the looping structure to the next statement in the procedure. The structure is similar to the simple LOOP structure, except that the counting variable and the number of iterations are defined in the header of the numeric FOR structure. This makes it easier ...

Get Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.