Syntax
BITAND( argument1, argument2 )
BITAND computes an AND operation on the bits of argument1 and argument2, both of which must resolve to nonnegative integers, and returns an integer. This function is commonly used with the DECODE expression, as illustrated in the example that follows.
Example
Consider the following table named cars:
MANUFACTURER MODEL OPTIONS
TOYOTA CAMRY 3
TOYOTA COROLLA 5
NISSAN MAXIMA 6
The following example represents each option in each car by individual bits:
SELECT manufacturer, model,
DECODE(BITAND(options, 1), 1, ‘Automatic’, ‘Stick-shift’),
DECODE(BITAND(options, 2), 2, ‘CD’, ‘Radio’),
DECODE(BITAND(options, 4), 4, ‘ABS’, ‘No-ABS’)
FROM cars;
MANUFACTURER MODEL DECODE(BITA DECOD DECODE
TOYOTA CAMRY Automatic CD No-ABS
TOYOTA COROLLA Automatic Radio ABS
NISSAN MAXIMA Stick-shift CD ABS




