Conditional Statements
The following code segment shows the IF-THEN-ELSIF construct. The ELSIF and ELSE parts are optional so it is possible to create simpler IF-THEN or, IF-THEN-ELSE constructs.
IF x = 1 THEN sequence_of_statements_1; ELSIF x = 2 THEN sequence_of_statements_2; ELSIF x = 3 THEN sequence_of_statements_3; ELSIF x = 4 THEN sequence_of_statements_4; ELSIF x = 5 THEN sequence_of_statements_5; ELSE sequence_of_statements_N; END IF;The CASE statement simplifies some large IF-THEN-ELSE structures.
CASE WHEN x = 1 THEN sequence_of_statements_1; WHEN x = 2 THEN sequence_of_statements_2; WHEN x = 3 THEN sequence_of_statements_3; WHEN x = 4 THEN sequence_of_statements_4; WHEN x = 5 THEN sequence_of_statements_5; ELSE sequence_of_statements_N; END CASE;CASE statement can be used with predefined selector:
CASE x WHEN 1 THEN sequence_of_statements_1; WHEN 2 THEN sequence_of_statements_2; WHEN 3 THEN sequence_of_statements_3; WHEN 4 THEN sequence_of_statements_4; WHEN 5 THEN sequence_of_statements_5; ELSE sequence_of_statements_N; END CASE;Read more about this topic: PL/SQL
Famous quotes containing the words conditional and/or statements:
“The population of the world is a conditional population; these are not the best, but the best that could live in the existing state of soils, gases, animals, and morals: the best that could yet live; there shall be a better, please God.”
—Ralph Waldo Emerson (18031882)
“The true critic is a scrupulous avoider of formulae; he refrains from statements which pretend to be literally true; he finds fact nowhere and approximation always.”
—T.S. (Thomas Stearns)