Progress
SQL-92
Guide and Reference
Conditional Expressions
Conditional expressions are a subset of scalar functions that generate different results depending on tests of the values of their arguments. They provide some of the flexibility of traditional programming constructs to allow expressions to return varying results depending on the value of their arguments.
The following scalar functions provide support for conditional expressions:
CASE is the most general conditional expression. It specifies a series of search conditions and associated expressions. SQL returns the value specified by the first expression whose associated search condition evaluates as true. If none of the expressions evaluate as true, the CASE expression returns a null value, or the value of some other default expression if the CASE expression includes the ELSE clause.
All the other conditional expressions can also be expressed as CASE expressions.
DECODE is not compatible with the SQL-92 standard.
NULLIF substitutes a null value for an expression if it is equal to a second expression.
COALESCE specifies a series of expressions. SQL returns the first expression whose value is not null. If all the expressions evaluate as null, COALESCE returns a null value.
IFNULL substitutes a specified value if an expression evaluates as null. If the expression is not null, IFNULL returns the value of the expression.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |