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.
If a length is declared for this type of column, it represents the size of the inline space to store the initial n bytes of data for the large object. For more information, see Storing BLOBs Inline the Database Administrator Guide.
In embedded SQL, data handlers can be created, which are routines to read and write the data for columns that contain large objects. For more information on data handlers, see Data Handlers for Large Objects (see 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 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
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 declared length for this type of column represents the size in bytes of the inline space, not a maximum size.
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.