Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Computes the bitwise OR of all non-null input values.
Syntax
bit_or(<expression>)
Arguments
Required
<expression>: An expression of an integral type.
Returns
Returns the same type as the argument. Returns NULL if no non-null input values exist.
Considerations
- NULL values are ignored in the calculation.
- Returns NULL when all input values are NULL or the set is empty.
- Useful for combining flags or checking if any bit is set across values.
Examples
Bitwise OR of Values
Compute the bitwise OR of a column.
SELECT bit_or(permissions) AS all_permissions
FROM user_roles;
Combine Flags
Combine all flags from a group.
SELECT user_id, bit_or(feature_flags) AS enabled_features
FROM user_settings
GROUP BY user_id;