Lab 5.2 ELSIF Statements

Lab Objectives

After this Lab, you will be able to:

Use the ELSIF Statement

An ELSIF statement has the following structure:

IF CONDITION 1 THEN 
   STATEMENT 1; 
ELSIF CONDITION 2 THEN 
   STATEMENT 2; 
ELSIF CONDITION 3 THEN 
   STATEMENT 3; 
… 
ELSE 
   STATEMENT N; 
END IF; 

The reserved word IF marks the beginning of an ELSIF construct. The words CONDITION 1 through CONDITION N are a sequence of the conditions that evaluate to TRUE or FALSE. These conditions are mutually exclusive. In other words, if CONDITION 1 evaluates to TRUE, STATEMENT 1 is executed, and control is passed to the first executable statement after the reserved phrase END IF. The rest of the ELSIF construct is ignored. When CONDITION 1 evaluates to FALSE, control ...

Get Oracle® PL/SQL® Interactive Workbook, Second Edition 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.