The following table lists the available bit manipulation functions, and a description of their purpose.
| Function | Description |
|---|---|
| BITAND | Performs the logical AND operation on the corresponding bits from the two input arguments. |
| BITOR | Performs the logical OR operation on the corresponding bits from the two input arguments. |
| BITNOT | Performs a bitwise complement on the binary representation of the input argument. |
| BITXOR | Performs a bitwise XOR operation on the binary representation of the two input arguments. |
| COUNTSET | Returns the count of the binary bits within the target_arg expression that are either set to 1 or set to 0 depending on the target_value_arg value. |
| GETBIT | Returns the value of the bit specified by target_bit_arg from the target_arg byte expression. |
| ROTATELEFT | Returns the expression target_arg rotated by the specified number of bits (num_bits_arg) to the right, with the most significant bits wrapping around to the left. |
| ROTATERIGHT | Returns the expression target_arg rotated by the specified number of bits (num_bits_arg) to the right, with the least significant bits wrapping around to the left. |
| SETBIT | Returns the value of the bit specified by target_bit_arg from the target_arg byte expression. |
| SHIFTLEFT | Returns the expression target_arg shifted by the specified number of bits (num_bits_arg) to the left. The bits in the most significant positions are lost, and the bits in the least significant positions are filled with zeros. |
| SHIFTRIGHT | Returns the expression target_arg shifted by the specified number of bits (num_bits_arg) to the right. The bits in the least significant positions are lost, and the bits in the most significant positions are filled with zeros. |
| SUBBITSTR | Extracts a bit substring from the target_arg input expression based on the specified bit position. |
| TO_BYTE | Converts a numeric data type to the Teradata Database server byte representation (byte value) of the input value. |
See the Teradata Database SQL Functions, Operators, Expressions, and Predicates document, B035-1145, for a detailed overview of these bit manipulation functions.