Javatpoint Logo
Javatpoint Logo

PL/SQL Case Statement

The PL/SQL CASE statement facilitates you to execute a sequence of satatements based on a selector. A selector can be anything such as variable, function or an expression that the CASE statement checks to a boolean value.

The CASE statement works like the IF statement, only using the keyword WHEN. A CASE statement is evaluated from top to bottom. If it get the condition TRUE, then the corresponding THEN calause is executed and the execution goes to the END CASE clause.

Syntax for the CASE Statement:

Example of PL/SQL case statement

Let's take an example to make it clear:

After the execution of above code, you will get the following result:

Excellent
PL/SQL procedure successfully completed. 
Next TopicPL/SQL Loop




Please Share

facebook twitter google plus pinterest tumbler

Latest 4 Tutorials