Firebird Documentation IndexFirebird 2.0 Language Ref. UpdateInternal functions → IIF()
Firebird Home Firebird Home Prev: GEN_ID()Firebird Documentation IndexUp: Internal functionsNext: LOWER()

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: GEN_ID()Firebird Documentation IndexUp: Internal functionsNext: LOWER()
Firebird Documentation IndexFirebird 2.0 Language Ref. UpdateInternal functions → IIF()