Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

IIF

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The IIF() function checks if the first argument is TRUE to produce the second argument, or the third argument otherwise. It works in a similar way as the NVL2 function or the CASE expression

SELECT
  iif(1 = 1, 3, 4),
  iif(1 = 2, 3, 4);
create.select(
  iif(inline(1).eq(inline(1)), inline(3), inline(4))
  iif(inline(1).eq(inline(2)), inline(3), inline(4))).fetch();

The result being

+-----+-----+
| iif | iif |
+-----+-----+
|   3 |   4 |
+-----+-----+
iif(inline(1).eq(inline(2)), inline(3), inline(4))

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo