Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Set the value of a specific bit in a bit array.
SET_BIT( [ bit-expression, ]bit-position [, value ] )
The bit array in which to change the bit.
The position of the bit to be set. This must be an unsigned integer.
The value to which the bit is to be set.
The default value of bit-expression is a bit array of length bit-position, containing all bits set to 0 (FALSE).
The default value of value is 1 (TRUE).
The result is NULL if any parameter is NULL.
The positions in the array are counted from the left side, starting at 1.
The following statement returns the value 00100011:
SELECT SET_BIT( '00110011', 4 , 0);
The following statement returns the value 00111011:
SELECT SET_BIT( '00110011', 5 , 1);
SELECT SET_BIT( '00110011', 5 );
The following statement returns the value 00001:
SELECT SET_BIT( 5 );