BIT_OR

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Computes the bitwise OR of all non-null input values.

Syntax 

1bit_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.

1SELECT bit_or(permissions) AS all_permissions
2FROM user_roles;

Combine Flags 

Combine all flags from a group.

1SELECT user_id, bit_or(feature_flags) AS enabled_features
2FROM user_settings
3GROUP BY user_id;

Related Documentation