The SQL LVARCHAR data type
The LVARCHAR data type of SQL stores variable-length character strings whose length can be up to 32,739 bytes. LVARCHAR is a built-in opaque data type that is valid in distributed queries of tables, views, and synonyms of databases outside the local server.
The DataBlade®
API supports
the LVARCHAR data type with the mi_lvarchar data type, which
is implemented in the DataBlade®
API as
a varying-length structure.
Tip: The SQL data type LVARCHAR
and the DataBlade®
API data
type mi_lvarchar are not the same. Although you use mi_lvarchar to
hold LVARCHAR data, mi_lvarchar is also used for other purposes.
If you declare no maximum size for an LVARCHAR column, the default size is 2 KB. The maximum valid size is 32,739 bytes, but the maximum row size in a database table is limited to 32 KB. (In addition, no more than 195 columns in the same database table can be of varying-length data types, named or unnamed ROW data types, collection data types, or simple large object data types, regardless of the declared size of individual columns.)
If you attempt
to insert more than the declared maximum size into an LVARCHAR column,
the result depends on the data type of the data:
- If the value comes from a built-in type (such as CHAR or VARCHAR), the database server truncates the data to the declared column size.
- The database server does not truncate data strings that come from an mi_lvarchar structure, but the database server does return an error.
Tip: If you need to store more than 32,739 bytes
of text data in a database of the local database server, use the CLOB
data type. With the CLOB data type, you can store the text data outside
the database table, in an sbspace.