Character Set Storage Requirements (Language Reference Guide)

From InterBase
Jump to: navigation, search

Go Up to InterBase Character Sets and Collation Orders


Knowing the storage requirements of a particular character set is important, because InterBase restricts the maximum amount of storage in each field in the column to 32,767 bytes for CHAR columns and 32,765 for VARCHAR columns. In the case of a single-byte character column, one character is stored in one byte, so you can define 32,767 (or 32,765 for VARCHAR) characters per single-byte column without encountering an error.

For multi-byte character sets, to determine the maximum number of characters allowed in a column definition, divide the internal byte storage limit for the data type by the number of bytes for each character. Thus, two-byte character sets have a character limit of 16,383 per field, and three-byte character sets have a limit of 10,922 characters per field. For VARCHAR columns, the numbers are 16,382 and 10.921 respectively.

The following examples specify a CHAR data type using the ­UNICODE_FSS character set, which has a maximum size of three bytes for a single character:

CHAR (10922) CHARACTER SET UNICODE_FSS; /* succeeds
*/
CHAR (10923) CHARACTER SET UNICODE_FSS; /* fails */

Advance To: