# `BIT_OR`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

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

## Syntax

```sql
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.

```sql
SELECT bit_or(permissions) AS all_permissions
FROM user_roles;
```

### Combine Flags

Combine all flags from a group.

```sql
SELECT user_id, bit_or(feature_flags) AS enabled_features
FROM user_settings
GROUP BY user_id;
```

## Related Documentation

- [BIT_AND](/docs/data/data-cloud-query-guide/references/dc-sql-reference/bit-and.md)
- [Aggregate Functions](/docs/data/data-cloud-query-guide/references/dc-sql-reference/aggregate.md)
