0% found this document useful (0 votes)
28 views11 pages

Oraclepresentation 130710113309 Phpapp02

Uploaded by

Hazbiy Shaffan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views11 pages

Oraclepresentation 130710113309 Phpapp02

Uploaded by

Hazbiy Shaffan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Oracle

CONTROL STRUCTURE
PL/SQL IF/THEN/ELSE Statement
The IF/THEN statement checks a Boolean value or expression
and if true, executes the statements in the THEN clause.
If the condition is false, the statements in the THEN
clause are skipped and execution jumps to the END IF, and
the expression that is checked must return a true or
false. It can be a simple Boolean variable or a compound
expression joined with AND/OR clauses, and the expression
can even be a PL/SQL function that returns a Boolean
value.
• IF...THEN
• IF...THEN...ELSE
• IF...THEN...ELSIF...ENDIF
• IF…THEN…ELSIF…THEN…ELSE…END IF

IF THEN statement

• IF THEN...END IF statement is a single-level


conditional statement which executes a sequence of
statements based on a given condition.
• Syntax:
IF condition THEN
executable statements
END IF;
• Condition
Expression evaluates to TRUE or FALSE
If TRUE commands execute
Demonstration
PL/SQL Comparison Operators

5
IF THEN ELSE statement
• The IF-THEN-ELSE statement is next level of extension
of above the IF-THEN statement, as it provides the
ability to give direction for FALSE or NULL also.

• Syntax:
IF condition THEN
executable statements 1
ELSE
executable statements 2
END IF;
Demonstration
IF THEN ELSIF ENDIF statement
• For multiple possible outcomes of a condition, we
use the IF THEN ELSIF ENDIF statement

• Syntax:
IF condition1 THEN
sequence_of_statements1
ELSIF condition2 THEN
sequence_of_statements2
ELSE
sequence_of_statements3
END IF;
Demonstration
Nested IF statement

• When using an ELSIF construct, it is not necessary


to specify what action should be taken if none of
the conditions evaluate to TRUE. In other words, an
ELSE clause is not required in the ELSIF construct.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy