Example: Querying the BITAND Operation On An INTEGER - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantageā„¢

The following query performs the BITAND operation on an INTEGER and a single-byte hexadecimal byte literal.

   SELECT BITAND(287454020, 'FFFF'XB);

The INTEGER value 287,454,020 has a hexadecimal value of 0x11223344 and a bit numbering representation of:



The hexadecimal byte literal 0xFFFF has a bit numbering representation of:



To process the BITAND operation, the two arguments are aligned on their least significant byte/bit as follows:





The shorter-length hexadecimal byte literal 0xFFFF is padded with zeros to the left until it is the same length as the INTEGER value 287,454,020.





When both operands are the same size, the BITAND operation is performed, producing the following result: