In this part, we will talk about conditions in PL/SQL. Dynamic designs necessitate that the software engineer indicate at least one conditions to be assessed or tried by the program, alongside an assertion or explanations to be executed if the condition is resolved to be valid, and alternatively, different articulations to be executed if the condition is resolved to be bogus.
Following is the overall type of a regular restrictive (i.e., dynamic) structure found in a large portion of the programming dialects −
PL/SQL programming language gives following sorts of dynamic explanations. Snap the accompanying connects to check their detail.
S.No | Statement & Description |
---|---|
1 |
IF - THEN statement The IF statement associates a condition with a sequence of statements enclosed by the keywords THEN and END IF. If the condition is true, the statements get executed and if the condition is false or NULL then the IF statement does nothing. |
2 |
IF-THEN-ELSE statement IF statement adds the keyword ELSE followed by an alternative sequence of statement. If the condition is false or NULL, then only the alternative sequence of statements get executed. It ensures that either of the sequence of statements is executed. |
3 |
IF-THEN-ELSIF statement It allows you to choose between several alternatives. |
4 |
Case statement Like the IF statement, the CASE statement selects one sequence of statements to execute. However, to select the sequence, the CASE statement uses a selector rather than multiple Boolean expressions. A selector is an expression whose value is used to select one of several alternatives. |
5 |
Searched CASE statement The searched CASE statement has no selector, and it's WHEN clauses contain search conditions that yield Boolean values. |
6 |
nested IF-THEN-ELSE You can use one IF-THEN or IF-THEN-ELSIF statement inside another IF-THEN or IF-THEN-ELSIF statement(s). |