Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
37
Добавлен:
16.04.2013
Размер:
5.97 Mб
Скачать

4

Using PL/SQL Control Structures

One ship drives east and another drives west With the selfsame winds that blow.

'Tis the set of the sails and not the gales

Which tells us the way to go. —Ella Wheeler Wilcox

This chapter shows you how to structure the flow of control through a PL/SQL program. PL/SQL provides conditional tests, loops, and branches that let you produce well-structured programs.

This chapter contains these topics:

Overview of PL/SQL Control Structures on page 4-1

Testing Conditions: IF and CASE Statements on page 4-2

Controlling Loop Iterations: LOOP and EXIT Statements on page 4-6

Sequential Control: GOTO and NULL Statements on page 4-12

Overview of PL/SQL Control Structures

Procedural computer programs use the basic control structures shown in Figure 4–1.

Figure 4–1

Control Structures

 

 

 

 

 

 

Selection

Iteration

 

Sequence

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

T

 

F

 

 

F

T

The selection structure tests a condition, then executes one sequence of statements instead of another, depending on whether the condition is true or false. A condition is any variable or expression that returns a Boolean value (TRUE or FALSE). The iteration

Using PL/SQL Control Structures 4-1

Тут вы можете оставить комментарий к выбранному абзацу или сообщить об ошибке.

Оставленные комментарии видны всем.

Соседние файлы в папке Oracle 10g