Firebird Documentation Index → Firebird 2.0 Language Ref. Update → Internal functions → IIF() |
Find a more recent version at Firebird 5.0 Language Reference: IIF()
Available in: DSQL, PSQL
Added in: 2.0
Description: IIF takes three arguments. If the first evaluates to
true
, the second argument is returned; otherwise the third is
returned.
Result type: Depends on input.
Syntax:
IIF (<condition>
,ResultT
,ResultF
)<condition>
::= A boolean expression.
Example:
select iif( sex = 'M', 'Sir', 'Madam' ) from Customers
IIF(Cond
, Result1
,
Result2
) is a shortcut for “CASE
WHEN Cond
THEN
Result1
ELSE Result2
END”. You can also compare IIF to the ternary
“?
:
” operator in C-like languages.
Firebird Documentation Index → Firebird 2.0 Language Ref. Update → Internal functions → IIF() |