IF
Examples
-
An example using the
IF
statement.Assume that the variablesFIRST
,LINE2
andLAST
were declared earlier.... IF (FIRST IS NOT NULL) THEN LINE2 = FIRST || ' ' || LAST; ELSE LINE2 = LAST; ...
-
Given
IF … THEN … ELSE
is a statement, it is possible to chain them together.Assume that theINT_VALUE
andSTRING_VALUE
variables were declared earlier.IF (INT_VALUE = 1) THEN STRING_VALUE = 'one'; ELSE IF (INT_VALUE = 2) THEN STRING_VALUE = 'two'; ELSE IF (INT_VALUE = 3) THEN STRING_VALUE = 'three'; ELSE STRING_VALUE = 'too much';
This specific example can be replaced with a simple
CASE
or theDECODE
function.