• | 

Bitwise OR. 

The result type depends on whether the arguments are evaluated as binary strings or numbers: 

•Binary-string evaluation occurs when the arguments have a binary string type, and at least one of them is not a hexadecimal literal, bit literal, or NULL  literal. Numeric evaluation occurs otherwise, with argument conversion to unsigned 64-bit integers as necessary. 

•Binary-string evaluation produces a binary string of the same length as the arguments. If the arguments have unequal lengths, an ER_INVALID_BITWISE_OPERANDS_SIZE  error occurs. Numeric evaluation produces an unsigned 64-bit integer. 

For more information, see the introductory discussion in this section. 

mysql> SELECT 29 | 15; -> 31 mysql> SELECT _binary X’40404040’ | X’01020304’; -> ’ABCD’ 

If bitwise OR is invoked from within the mysql  client, binary string results display using hexadecimal notation, depending on the value of the --binary-as-hex . For more information about that option, see Section 4.5.1, “mysql — The MySQL Command-Line Client” . 

• & 

Bitwise AND. 

The result type depends on whether the arguments are evaluated as binary strings or numbers: 

•Binary-string evaluation occurs when the arguments have a binary string type, and at least one of them is not a hexadecimal literal, bit literal, or NULL  literal. Numeric evaluation occurs otherwise, with argument conversion to unsigned 64-bit integers as necessary. 

•Binary-string evaluation produces a binary string of the same length as the arguments. If the arguments have unequal lengths, an ER_INVALID_BITWISE_OPERANDS_SIZE  error occurs. Numeric evaluation produces an unsigned 64-bit integer. 

For more information, see the introductory discussion in this section. mysql> SELECT 29 & 15; 

-> 13 mysql> SELECT HEX(_binary X’FF’ & b’11110000’); -> ’F0’ 

If bitwise AND is invoked from within the mysql  client, binary string results display using hexadecimal notation, depending on the value of the --binary-as-hex . For more information about that option, see Section 4.5.1, “mysql — The MySQL Command-Line Client” . 

• ^ 

Bitwise XOR. 

The result type depends on whether the arguments are evaluated as binary strings or numbers: 

•Binary-string evaluation occurs when the arguments have a binary string type, and at least one of them is not a hexadecimal literal, bit literal, or NULL  literal. Numeric evaluation occurs otherwise, with argument conversion to unsigned 64-bit integers as necessary. 

