Neoview SQL Reference Manual (R2.5)
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.
Collations
A collation contains rules for a collating sequence (the sequence in which characters are ordered
for sorting), case, and character class and character string equivalence. To be compared, character
strings must be from the same character set. When two strings are compared, the comparison is
made with a temporary copy of the shorter string that has been padded on the right with blanks
to have the same length as the longer string.
In Neoview SQL, a character data type can be associated only with the DEFAULT collation,
which compares the binary code values of characters in a character string. When comparing two
equal length strings, s1 and s2, Neoview SQL compares the binary code values of the
corresponding characters of s1 and s2 until it finds a difference. If Neoview SQL finds a difference
and the differing character value of s1 is less than that of s2, s1 is considered to come before
s2. If the differing character value of s2 is less than that of s1, s2 is considered to come before
s1. If there is no difference, s2 is considered equal to s2.
Data Types 249