8. SQL Statements : IF - THEN - ELSE : Description : If...Then Statement
 
Share this page                  
If...Then Statement
The second form of the IF statement includes the ELSE clause. The syntax follows:
IF boolean_expr THEN
       statement; {statement;}
ELSE
       statement; {statement;}
ENDIF
In this form, if the Boolean expression is true, the statements immediately following the keyword THEN are executed. If the expression is false (or unknown), the statements following the keyword ELSE are executed. In either case, after the appropriate statement list is executed, control passes to the statement immediately following ENDIF.