Database Reference
In-Depth Information
temp := num1;
num1 := num2;
num2 := temp;
END IF;
DBMS_OUTPUT.PUT_LINE ('num1 = '||num1);
DBMS_OUTPUT.PUT_LINE ('num2 = '||num2);
END;
8.7.2 IF-THEN-ELSE Statement
IF-THEN-ELSE format is used when we want to choose between two mutually exclusive
actions. An IF-THEN-ELSE statement allows us to specify two groups of statements.
When the value of condition is TRUE, first group of statements is executed. When the con-
dition evaluates to FALSE another group of statements is executed. This is shown as fol-
lows:
IF condition THEN
statement 1;
ELSE
statement 2;
END IF;
statement 3;
When the value of condition is TRUE, control is passed to statement 1; when the value of
condition is FALSE, control is transferred to statement 2; After the IFTHEN-ELSE con-
struct has completed, statement 3; is executed
Search WWH ::




Custom Search