All versions: 3.11 | 3.10 | 3.9 | 3.8 | 3.7 | Development versions: 3.12 | Unsupported versions: 3.6 | 3.5 | 3.4 | 3.3 | 3.2 | 2.6

Interestingly, bitwise functions and bitwise arithmetic is not very popular among SQL databases. Most databases only support a few bitwise operations, while others ship with the full set of operators. jOOQ's API includes most bitwise operations as listed below. In order to avoid ambiguities with conditional operators, all bitwise functions are prefixed with "bit"

  • BIT_COUNT: Count the number of bits set to 1 in a number
  • BIT_AND: Set only those bits that are set in two numbers
  • BIT_OR: Set all bits that are set in at least one number
  • BIT_NAND: Set only those bits that are set in two numbers, and inverse the result
  • BIT_NOR: Set all bits that are set in at least one number, and inverse the result
  • BIT_NOT: Inverse the bits in a number
  • BIT_XOR: Set all bits that are set in at exactly one number
  • BIT_XNOR: Set all bits that are set in at exactly one number, and inverse the result
  • SHL: Shift bits to the left
  • SHR: Shift bits to the right

Some background about bitwise operation emulation

As stated before, not all databases support all of these bitwise operations. jOOQ emulates them wherever this is possible. More details can be seen in this blog post:
http://blog.jooq.org/2011/10/30/the-comprehensive-sql-bitwise-operations-compatibility-list/

The jOOQ Logo