BITOR

functionsupportedCore SQL functions

docs.snowflake.com ↗

Bitwise expression functions

Returns the bitwise OR of two numeric or binary expressions.

Syntax

supportedpartialnot supportednot scored

BITOR( <expr1> , <expr2> [ , '<padside>' ] )

Parameters

NameRequiredDescription
expr1requiredThis expression must evaluate to an INTEGER value, a BINARY value, or a value of a data type that can be cast to an INTEGER value.
expr2requiredThis expression must evaluate to an INTEGER value, a BINARY value, or a value of a data type that can be cast to an INTEGER value.
'padside'requiredWhen two BINARY argument values are not the same length, specifies which side to pad the value with the shorter length. Specify one of the following case-insensitive values: LEFT - Pad the value on the left. RIGHT - Pad the value on the right. The shorter value is padded with zeros so that it equals the length of the larger value. This argument is valid only when BINARY expressions are specified. If the length of two BINARY values are different, this argument is required.

Returns

Returns an INTEGER value, a BINARY value, or NULL: - When the input expressions contain INTEGER values, returns an INTEGER value that represents the bitwise OR of the input expressions. - When the input expressions contain BINARY values, returns a BINARY value that represents the bitwise OR of the input expressions. - If either input value is NULL, returns NULL.

Usage notes

Using BITAND, BITOR, and BITXOR with INTEGER argument values

Create a simple table and insert the data: Run the query:

Using BITAND, BITOR, and BITXOR with BINARY argument values

Create a simple table and insert the data: Note The BINARY values are inserted using the x'value' notation, where value contains hexadecimal digits. For more information, see Binary input and output. Run a query on BINARY columns of the same length: If you try to run a query on BINARY columns of different lengths without specifying the 'padside' argument, an error is returned: Run a query on BINARY columns of different lengths, and pad the smaller argument value on the left: Run a query on BINARY columns of different lengths, and pad the smaller argument value on the right:

See also

Referenced by