VARCHAR

The VARCHAR data type provides for variable-length storage of strings.

Syntax

{ VARCHAR | CHAR VARYING | CHARACTER VARYING }(length)

length

An unsigned integer constant. The maximum length for a VARCHAR string is 32,672 characters.

Corresponding Compile-time Java Type

java.lang.String

JDBC Metadata Type (java.sql.Types)

VARCHAR

Example

VARCHAR(2048);

Usage Notes

Here are several notes for the VARCHAR data type:

  • Splice Machine does not pad a VARCHAR value whose length is less than specified.
  • Splice Machine truncates spaces from a string value when a length greater than the VARCHAR expected is provided. Characters other than spaces are not truncated, and instead cause an exception to be raised.
  • When comparison boolean operators are applied to VARCHARs, the lengths of the operands are not altered, and spaces at the end of the values are ignored.
  • When CHARs and VARCHARs are mixed in expressions, the shorter value is padded with spaces to the length of the longer value.
  • The type of a string constant is CHAR, not VARCHAR.