The bit_xor() function

The bit_xor() function performs a bitwise logical XOR on two binary data type columns.

Syntax

bit_xor(column1, column2)
column1, column2
Two input binary data type columns.

Usage

If the columns are of different lengths, the return value is the same length as the longer input parameter, with the XOR operation performed up to the length of the shorter parameter. The remainder of the return value is the unprocessed data in the longer parameter.

Return codes

The function returns the value of the bitwise logical XOR operation.

If either parameter is NULL, the return value is also NULL.

Example

In the following example, the value of binaryvarcol1 is '00086000':
SELECT bit_xor(binaryvar_col1, '00004000'::binaryvar) FROM table WHERE x = 1'
expression
------------------
00082000