Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateInternal functions → IIF()
Firebird Home Firebird Home Prev: HASH()Firebird Documentation IndexUp: Internal functionsNext: LEFT()

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.

Prev: HASH()Firebird Documentation IndexUp: Internal functionsNext: LEFT()
Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateInternal functions → IIF()