Conditional Statements in PL/SQL

Conditional Statements in PL/SQL

PL/SQL supports programming language features like conditional statements and iterative statements.
The programming constructs are similar to how to use in programming languages like Java and C++. In this section I will provide you syntax of how to use conditional statements in PL/SQL programming.

Following are the Syntax for the if-then-else statement.
1 Simple IF Then Statement
IF condition THEN
Statement 1;
END IF;

2 IF then else statement
IF condition THEN
Statement 1;
ELSE
Statement 2;
END IF;

3 IF Then ElsIf Statement
IF condition 1 THEN
Statement 1;
Statement 2;
ELSIF condtion2 THEN
Statement 3;
ELSE
Statement 4;
END IF

4 Nested If Then Statement
IF condition1 THEN
Statement1
ELSE
IF condition2 THEN
Statement2;
END IF;
ELSIF condition3 THEN
Statement3;
END IF;

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License