A binary string is a sequence of bytes. Unlike a character string which usually contains text data, a binary string is used to hold non-traditional data such as pictures. The length of a binary string is the number of bytes in the sequence. A binary string has a CCSID of 65535. Only character strings of FOR BIT DATA are compatible with binary strings.
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 through 32 766 inclusive. See SQL limits for more information.
The types of varying-length binary strings are:
A Binary Large OBject (BLOB) column is useful for storing large amounts of noncharacter data, such as pictures, voice, and mixed media. Another use is to hold structured data for exploitation by distinct types and user-defined functions.
Distinct types, columns, and variables all have length attributes. When varying-length binary-string distinct types, columns, and variables are defined, the maximum length is specified and this becomes the length attribute. Actual values may have a smaller length. For a varying-length binary string, the length attribute must be between 1 through 32 740 bytes inclusive. For a BLOB string, the length attribute must be between 1 through 2 147 483 647 inclusive. See SQL limits for more information.
A variable with a binary string type can be defined in all host languages except REXX, RPG/400®, and COBOL/400®.