Lab 6.1 CASE Statements

Lab Objectives

After this Lab, you will be able to:

Use CASE Statements

Use Searched CASE Statements

A CASE statement has two forms: CASE and searched CASE. A CASE statement allows you to specify a selector that determines which group of actions to take. A searched CASE statement does not have a selector; it has search conditions that are evaluated in order to determine which group of actions to take.

CASE Statements

A CASE statement has the following structure:

CASE SELECTOR 
   WHEN EXPRESSION 1 THEN STATEMENT 1; 
   WHEN EXPRESSION 2 THEN STATEMENT 2; 
   … 
   WHEN EXPRESSION N THEN STATEMENT N; 
   ELSE STATEMENT N+1; 
END CASE; 

The reserved word CASE marks the beginning of the CASE statement. A selector is a value that determines ...

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.