O'Reilly logo

Oracle® PL/SQL® Interactive Workbook, Second Edition by Elena Silvestrova, Benjamin Rosenzweig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lab 8.1 Simple Loops

Lab Objectives

After this Lab, you will be able to:

Use Simple Loops with EXIT Conditions

Use Simple Loops with EXIT WHEN Conditions

A simple loop, as you can see from its name, is the most basic kind of loop and has the following structure:

LOOP 
   STATEMENT 1; 
   STATEMENT 2; 
   … 
   STATEMENT N; 
END LOOP; 

The reserved word LOOP marks the beginning of the simple loop. Statements 1 through N are a sequence of statements that is executed repeatedly. These statements consist of one or more of the standard programming structures. END LOOP is a reserved phrase that indicates the end of the loop construct.

The flow of logic from this structure is illustrated in Figure 8.1.

Figure 8.1. Simple Loop

Every time the loop is iterated, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required