Bitand Function; Considerations For Bitand; Restrictions For Bitand; Examples Of Bitand - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

BITAND Function

The BITAND function performs an AND operation on corresponding bits of the two operands.
If both bits are 1, the result bit is 1. Otherwise the result bit is 0.
BITAND (expression, expression)
expression
The result data type is a binary number. Depending on the precision of the operands, the
data type of the result can either be an INT (32-bit integer) or a LARGEINT (64-bit integer).
If the max precision of either operand is greater than 9, LARGEINT is chosen (numbers with
precision greater than 9 are represented by LARGEINT). Otherwise, INT is chosen.
If both operands are unsigned, the result is unsigned. Otherwise, the result is signed.
Both operands are converted to the result data type before performing the bit operation.

Considerations for BITAND

BITAND can be used anywhere in a SQL query where an expression could be used. This includes
SELECT lists, WHERE predicates, VALUES clauses, SET statement, and so on.
This function returns a numeric data type and can be used in arithmetic expressions.
Numeric operands can be positive or negative numbers. All numeric data types are allowed with
the exceptions listed in the

Restrictions for BITAND

The following are BITAND restrictions:
must have 2 operands
operands must be binary or decimal exact numerics
operands must have scale of zero
operands cannot be floating point numbers
operands cannot be an extended precision numeric (the maximum precision of an extended
numeric data type is 128)

Examples of BITAND

>>select bitand(1,3) from (values(1)) x(a);
(EXPR)
--------------
--- 1 row(s) selected
>>select 1 & 3 from (values(1)) x(a);
(EXPR)
--------------
--- 1 row(s) selected
>>select bitand(1,3) + 0 from (values(1)) x(a);
(EXPR)
--------------
--- 1 row(s) selected
"Restrictions for BITAND"
1
1
1
section.
BITAND Function
353

Advertisement

Table of Contents
loading

Table of Contents