3. Understanding SQL Data Types : SQL Data Types : Character Data Types : Long Varchar Data Types
 
Share this page                  
Long Varchar Data Types
The long varchar data type has the same characteristics as the varchar data type, but can accommodate strings up to 2 GB in length.
Do not declare a length for long varchar columns. In embedded SQL, data handlers can be created, which are routines to read and write the data for long varchar (and long byte) columns. For more information on data handlers, see Data Handlers for Large Objects (see page Data Handlers for Large Objects) and the Embedded SQL Companion Guide.
Restrictions on Long Varchar Columns
The following restrictions apply to long varchar columns:
They cannot be part of a table key.
They do not declare a length.
They cannot be part of a secondary index.
They cannot be used in the ORDER BY or GROUP BY clause in a SELECT statement.
They can be included in a select list with the DISTINCT qualifier, but duplicate values will not be eliminated.
They cannot have query optimization statistics. For details about query optimization statistics, see the optimizedb command in the Command Reference Guide.
They are not considered as potential numeric data with mixed-type comparisons.
The following string functions do not work with long varchar columns:
LOCATE
PAD
SHIFT
SQUEEZE
TRIM
NOTRIM
CHAREXTRACT
BYTEEXTRACT
LEFT
RIGHT
SUBSTRING
They cannot be directly compared to other string data types. To compare a long varchar column to another string data type, apply a coercion function.
A string literal of more than 2000 characters cannot be assigned to a long varchar column. Details about assigning long strings to these columns are found in the description of data handlers in the Embedded SQL Companion Guide or the OpenAPI User Guide.