Binary strings
A binary string is a sequence of bytes. The length of a binary string is the number of bytes in the sequence.
Binary strings are not associated with any CCSID. The supported binary string data types are BINARY and VARBINARY (BINARY VARYING).
The following subtypes of binary strings are supported:
- Fixed-length binary strings
- The type of fixed-length binary strings is BINARY. When fixed-length binary string distinct types, columns, and variables are defined, the length attribute is specified, and all values have the same length. For a fixed-length binary string, the length attribute must be between 1 and 32704 inclusive.
- Varying-length binary strings
- All values of varying-length string columns have the same maximum
length, which is determined by the length attribute.
The varying-length binary string is VARBINARY (BINARY VARYING).
When varying-length binary strings, distinct types, columns, and variables are defined, the maximum length is specified and this length becomes the length attribute. Actual length values might have a smaller value than the length attribute value. For varying-length binary strings, the actual length specifies the number of bytes in the string.
For a VARBINARY string, the length attribute must be between 1 and 32704. Like a varying-length character string, varying-length binary string could be an empty string.
A binary string column is useful for storing non-character data, such as encoded or compressed data, pictures, voice, and mixed media. Another use is to hold structured data for exploitation by distinct types, user-defined functions, and stored procedures.