LONG VARCHAR(length) Data
This is used for a character string that has a long variable length. When you have long data that will vary greatly in length and it is important to save disk space, the LONG VARCHAR definition is used. If the maximum column length is large, and most of the time the column will be blank, then a large amount of storage can be saved.
The (length) represents an integer for the maximum length of this column definition and must be 1 or greater.
Some DBMS systems limit this to 32,767 characters and use VARCHAR for up to 255 characters.
Alphanumeric data can be stored in this definition.
If the length of the data entered into this column is shorter than the column definition, then the data is stored as is. For example, if the length is set to 2000 characters and only 200 characters are entered, then the length of the data is recorded with the 200 characters of data.
Example: COL1 LONG VARCHAR(2000)
COL1 is a maximum of 2,000 characters in length.
> Long variable columns should be defined only at the end of a table.
> DB2 uses LONG VARCHAR. This option should be used only when needed and has some restrictions.
It can’t be sorted by ORDER BY, GROUP BY, DISTINCT, or UNION without the ALL option.
It can’t be in a WHERE clause except with the LIKE clause.