3.2.6. BITAND(string1[,[string2][,padchar]])

Returns the result from bytewise applying the operator AND to the
characters in the two strings string1 and string2. Note that this
is not the logical AND operation, but the bitwise AND operation.
String2 defaults to a nullstring. The two strings are left-
justified; the first characters in both strings will be AND’ed,
then the second characters and so forth.

The behavior of this function when the two strings do not have
equal length is defined by the padchar character. If it is
undefined, the remaining part of the longer string is appended to
the result after all characters in the shorter string have been
processed. If padchar is defined, each char in the remaining part
of the longer string is logically AND’ed with the padchar (or
rather, the shorter string is padded on the right length, using
padchar).

When using this function on character strings, e.g. to uppercase
or lowercase a string, the result will be dependent on the
character set used. To lowercase a string in EBCDIC, use BITAND()
with a padchar value of ‘bf’x. To do the same in ASCII, use
BITOR() with a padchar value of ‘20’x.

     BITAND(‘123456’x, ‘3456’x)         –>   ‘101456’x
     BITAND(‘foobar’,, ‘df’x)      –>   ‘FOOBAR’ /*For ASCII*/
     BITAND(‘123456’x, ‘3456’x, ‘f0’x)  –>   ‘101450’x



PREV NEXT