Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Reference » SQL language elements » Expressions


IF expressions

The syntax of the IF expression is as follows:

IF condition
THEN expression1
[ ELSE expression2 ]

This expression returns the following:

  • If condition is TRUE, the IF expression returns expression1.

  • If condition is FALSE, the IF expression returns expression2.

  • If condition is FALSE, and there is no expression2, the IF expression returns NULL.

  • If condition is UNKNOWN, the IF expression returns NULL.

expression1 is evaluated only if condition is TRUE. Similarly, expression2 is evaluated only if condition is FALSE. Both expression1 and expression2 are arbitrary expressions; condition is any valid search condition.


The IF expression is not the same as the IF statement.

 Standards and compatibility
 See also