OceanBase Database supports the SET type. A SET is a string object and can have zero or more values that must come from a list of multiple values, such as 'value1', 'value2', ....
The SET type supports variable data length and the UTF8MB4 character set.
The syntax of SET is as follows:
SET('value1','value2',...) [CHARACTER SET charset_name] [COLLATE collation_name]
SET values are internally expressed as integers. You can define a maximum of 64 members in a SET column, and each member contains a maximum of 255 characters. Multiple members in a SET column are separated by commas (,).
For example, the SET('a', 'b') NOT NULL column can have the following values:
' '
'a'
'b'
'a,b'
The CHARACTER SET attribute specifies the character set. If necessary, you can use COLLATE and other attributes to specify the collation of the character set.
SET values are stored as numbers, and the lowest bit of the stored value corresponds to the first member of the set. SET values are sorted by number. NULL values are sorted before non-NULL values. In strict SQL mode, duplicate values result in alerts or errors. When you create a table, trailing spaces of members in the defined SET are automatically deleted.