16.20 - Description - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ SQL Functions, Expressions, and Predicates

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K
IF... THEN the function...
num_bits_arg is equal to zero returns target_arg unchanged.
num_bits_arg is negative shifts the bits to the right instead of the left.
target_arg and/or num_bits_arg are NULL returns NULL.
num_bits_arg is larger than the size of target_arg returns an error.

The scope of the shift operation is bounded by the size of the target_arg expression. Specifying a shift that is outside the range of target_arg results in an SQL error.

When operating against an integer value (BYTEINT, SMALLINT, INTEGER, or BIGINT), shifting a bit into the most significant position will result in the integer becoming negative. This is because all integers in Teradata Database are signed integers.