MAKE_SET()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a string of comma-separated bit names that are enabled in a bit value.
USAGE
MAKE_SET(bits, name[, name ...])
Argument Name | Description |
---|---|
| The integer whose bits are analyzed |
| The string to use if the associated bit is enabled |
DETAILS
MAKE_SET()
is a string function that returns a string of comma-separated bit names enabled in the numeric value.
The numeric value is interpreted as a binary number with each bit (from low to high) corresponding to a name in the argument list.
If a bit's name is not specified or is NULL
, that bit is not represented in the result.
The names of each enabled bit are concatenated together using a comma as the separator between multiple names and the resulting string is the return value.
EXAMPLES
SELECT MAKE_SET(1, 'a', 'b', 'c');
+----------------------------+
| MAKE_SET(1, 'a', 'b', 'c') |
+----------------------------+
| a |
+----------------------------+
SELECT MAKE_SET(2|8, 'r', 'd', 'b', 'm', 's');
+----------------------------------------+
| MAKE_SET(2|8, 'r', 'd', 'b', 'm', 's') |
+----------------------------------------+
| d,m |
+----------------------------------------+
SELECT MAKE_SET(2|4|8, 'r', NULL, 'b');
+---------------------------------+
| MAKE_SET(2|4|8, 'r', NULL, 'b') |
+---------------------------------+
| b |
+---------------------------------+