Creates a bit array where specific bits, corresponding to values from a set of rows, are set to 1 (TRUE).
SET_BITS( expression )
expression The expression used to determine which bits to set to 1. This is typically a column name.
Rows where the specified values are NULL are ignored.
If there are no rows, NULL is returned.
The length of the result is the largest position that was set to 1.
The SET_BITS function is equivalent to, but faster than, the following statement:
SELECT BIT_OR( SET_BIT( expression ) ) FROM table;
SQL/2003 Vendor extension.
The following statements return a bit array with the 2nd, 5th, and 10th bits set to 1 (or 0100100001):
CREATE TABLE t( r INTEGER ); INSERT INTO t values( 2 ); INSERT INTO t values( 5 ); INSERT INTO t values(10 ); SELECT SET_BITS( r ) FROM t;