Neoview SQL Reference Manual (R2.4 SP2)

CHAR[ACTER] VARYING (length) [CHARACTERS] [char-set] [UPSHIFT]
[[NOT]CASESPECIFIC]
specifies a column with varying-length character data. VARYING specifies that the number
of characters stored in the column can be fewer than the length.
Note that values in a column declared as VARYING can be logically and physically shorter
than the maximum length, but the maximum internal size of a VARYING column is actually
four bytes larger than the size required for an equivalent column that is not VARYING.
VARCHAR (length) [char-set] [UPSHIFT] [[NOT]CASESPECIFIC]
specifies a column with varying-length character data.
VARCHAR is equivalent to data type CHAR[ACTER] VARYING.
NCHAR [(length)] [UPSHIFT] [[NOT]CASESPECIFIC], NATIONAL CHAR[ACTER] [(length)]
[UPSHIFT] [[NOT]CASESPECIFIC]
specifies a column with data in the pre-defined national character set.
NCHAR VARYING [(length)] [UPSHIFT] [[NOT]CASESPECIFIC], NATIONAL CHAR[ACTER]
VARYING (length) [UPSHIFT] [[NOT]CASESPECIFIC]
specifies a column with varying-length data in the pre-defined national character set.
Considerations for Character String Data Types
Difference Between CHAR and VARCHAR
You can specify a fixed-length character column as CHAR(n), where n is the number of characters
you want to store. However, if you store five characters into a column specified as CHAR(10),
ten characters are stored where the rightmost five characters are blank.
If you do not want to have blanks added to your character string, you can specify a variable-length
character column as VARCHAR(n), where n is the maximum number of characters you want to
store. If you store five characters in a column specified as VARCHAR(10), only the five characters
are stored logically—without blank padding.
Maximum Byte Length of a Character Column
Maximum Length in TableData Type
32708Fixed-length
32708Variable-length
The maximum row size is 32708 bytes, but the actual maximum character column size is less
than that because of bytes used by the header, null indicator, column length indicator, and other
columns in the table.
NCHAR Columns in SQL Tables
In Neoview SQL, the NCHAR type specification is equivalent to:
NATIONAL CHARACTER
NATIONAL CHAR
CHAR ... CHARACTER SET ..., where the character set is the character set for NCHAR
Similarly, you can use NCHAR VARYING, NATIONAL CHARACTER VARYING, NATIONAL
CHAR VARYING, and VARCHAR ... CHARACTER SET ... , where the character set is the
character set for NCHAR. The character set for NCHAR is determined when Neoview SQL is
installed on the Neoview platform. By default, Neoview SQL is installed with UCS2 as NCHAR's
character set, unless you request to have Neoview SQL installed with ISO88591 as NCHAR's
character set.
236 SQL Language Elements