Pl Sql Tutorial
Pl Sql Conditional Statements
IF THEN END IF Statement
IF condition THEN
execute
ELSE
execute2
END IF;
IF condition THEN
execute
ELSE
IF condition2 THEN
execute
END IF;
END IF;
ELSIF clause can be used instead of nested IF
IF condition THEN
execute
ELSIF condition2 THEN execute2;
ELSIF condition3 THEN execute3;
END IF;
CASE WHEN THEN Statement
- expressions CASE (CASE Expressions) which return a result into a variable. End with END
- syntax CASE (CASE Statement) that run a specific statement. End with END CASE, and each row ends with;
CASE Expressions:
CASE selector
WHEN expression1 THEN result1
WHEN expression2 THEN result2
...
WHEN expressionN THEN resultN
[ELSE result N + 1]
END;
CASE Statement:
CASE selector
WHEN expression1 THEN action1;
WHEN expression2 THEN action2;
...
WHEN expressionN THEN actionN;
[ELSE action N + 1];
END CASE;