9.7. Bitwise Aggregate Functions
9.7.1. BIN_AND_AGG()
Bitwise AND on non-NULL values.
Result typeSame as type of expr
Syntax
BIN_AND_AGG ( <expr> )
BIN_AND_AGG Function Parameters| Parameter | Description |
|---|---|
expr | Expression of type |
The result is a cumulative application of bitwise AND on all non-NULL values.
If the group is empty or contains only NULLs, the result is NULL.
9.7.1.1. BIN_AND_AGG Examples
selectNAME,bin_and_agg(N) as F_ANDfrom ACL_MASKSgroup by NAME
See alsoSection 9.7.2, “BIN_OR_AGG()”, Section 9.7.3, “BIN_XOR_AGG()”, Section 8.6.1, “BIN_AND()”
9.7.2. BIN_OR_AGG()
Bitwise OR on non-NULL values.
Result typeSame as type of expr
Syntax
BIN_OR_AGG ( <expr> )
BIN_OR_AGG Function Parameters| Parameter | Description |
|---|---|
expr | Expression of type |
The result is a cumulative application of bitwise OR on all non-NULL values.
If the group is empty or contains only NULLs, the result is NULL.
9.7.2.1. BIN_OR_AGG Examples
selectNAME,bin_or_agg(N) as F_ORfrom ACL_MASKSgroup by NAME
See alsoSection 9.7.1, “BIN_AND_AGG()”, Section 9.7.3, “BIN_XOR_AGG()”, Section 8.6.3, “BIN_OR()”
9.7.3. BIN_XOR_AGG()
Bitwise XOR on non-NULL values.
Result typeSame as type of expr
Syntax
BIN_XOR_AGG ( [ ALL | DISTINCT ] <expr> )
BIN_XOR_AGG Function Parameters| Parameter | Description |
|---|---|
expr | Expression of type |
The result is a cumulative application of bitwise XOR on all non-NULL values (the default), or the distinct non-NULL values.
Contrary to Section 9.7.1, “BIN_AND_AGG()” and Section 9.7.2, “BIN_OR_AGG()”, this function accepts ALL or DISTINCT, as eliminating duplicates changes the result of the cumulative bitwise XOR.
ALL is the default if nothing is specified.
If the group is empty or contains only NULLs, the result is NULL.
9.7.3.1. BIN_XOR_AGG Examples
selectNAME,bin_xor_agg(N) as F_XOR,-- same as F_XORbin_xor_agg(all N) ad F_XOR_A,-- might be differentbin_xor_agg(distinct N) ad F_XOR_Dfrom ACL_MASKSgroup by NAME
See alsoSection 9.7.1, “BIN_AND_AGG()”, Section 9.7.2, “BIN_OR_AGG()”, Section 8.6.6, “BIN_XOR()”