SQL-J Language Reference
Page 103 of 121

NCHAR

NCHAR is similar to CHAR, except it is one of the international data types appropriate for localized databases. For more information, see International String Data Types.

For information about locales, see Appendix B, "Localizing Cloudscape" in the Cloudscape Developer's Guide.

Syntax for Column Definition

{ NCHAR | NATIONAL CHAR | NATIONAL CHARACTER } [(length)]

length is an unsigned integer literal. The default length for an NCHAR is 1.

Corresponding Compile-Time Java Type

java.lang.String

JDBC Metadata Type (java.sql.Types)

CHAR

Cloudscape inserts spaces to pad a string value shorter than the expected length. Cloudscape truncates spaces from a string value longer than the expected length. Characters other than spaces cause an exception to be raised. When binary comparison operators are applied to NCHARs, the shorter string is padded with spaces to the length of the longer string.

When NCHARs and VARCHARs or NVARCHARs are mixed in expressions, the shorter value is padded with spaces to the length of the longer value.

The type of a string literal is CHAR.

Implementation-Defined Aspects

The only limit on the length of NCHAR data types is the value java.lang.Integer.MAX_VALUE.