SQL Anywhere 10.0.1
» SQL Anywhere Server - SQL Reference
» SQL Functions
» Alphabetical list of functions

BIT_XOR function [Aggregate]
Takes n bit arrays and returns a bitwise exclusive OR-ing of its arguments using the following logic: for each bit compared, if there are an odd number of arguments with set bits (odd parity), return 1; otherwise, return 0.

Syntax
BIT_XOR( bit-expression )

Parameters
expression The expression for which the value is to be determined. This is commonly a column name.

See also
Standards and compatibility
Example
Suppose you have the following table, t, containing a single column, a, which is a VARBIT data type.

You want to know the XOR value for the column. You enter the following SELECT statement, which returns 0001:

SELECT BIT_XOR( a ) FROM t;
This result is determined as follows:

Row 1 (0001) is compared with Row 2 (0111), and results in 0110.

The result from the previous comparison (0110) is compared with Row 3 (0100), and results in 0010.

The result from the previous comparison (0010) is compared with Row 4 (0011), and results in 0001.