SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
C-13
Character Data Types
Character Data Types
SQL includes both fixed-length character data and varying-length character data.
Either type of character data can be associated with a character set. Any character
data type is compatible with any other character data type that is associated with the
same character set, but not with numeric, date-time, or interval data types, and not with
character data that is associated with a different character set.
The maximum length of a character column depends on whether the data type is
fixed-length or variable-length, whether the associated character set is single-byte or
double-byte, and on the file organization of the file that contains the column:
Each variable-length character data item requires two bytes of storage for length
information, in addition to the space required for the data itself. As a result, the
maximum length for a variable-length column is less than the maximum length for an
otherwise equivalent fixed-length column.
A column that allows null values requires two extra bytes.
A string literal can be as long as a character column.
Note that C string data types require an additional trailing null character. Because of
this additional null character, using C string data types disables the SQL bulk move
feature when you move contiguous data fields between the Executor Extended Data
Segment and program host variables.
Fixed-Length Types Varying-Length Types
CHAR[ACTER] CHAR[ACTER] VARYING
PIC X [DISPLAY] VARCHAR[ACTER]
NATIONAL
CHAR[ACTER]
NATIONAL CHAR[ACTER]
VARYING
NCHAR[ACTER] NCHAR[ACTER] VARYING
Data Type
Key-
Sequenced
Relative or Entry-
Sequenced
Single-byte unvarying 4061 4072
Single-byte VARYING 4059 4070
Double-byte unvarying 2030 2036
Double-byte VARYING 2029 2035