The lvarchar keyword syntax

To declare an lvarchar host variable for a character column (CHAR, VARCHAR, or LVARCHAR), use the lvarchar keyword as the variable data type.

The following syntax shows the lvarchar keyword as the variable data type.
Read syntax diagramSkip visual syntax diagram
                   .-,--------------------------------------.   
    (1)            V                                        |   
>>-------lvarchar----+-variable name--[--variable size--]-+-+--->
                     '-*--variable name-------------------'     

>--;-----------------------------------------------------------><

Notes:
  1. Informix® extension
Element Purpose Restrictions
variable name Name of an lvarchar variable of a specified size None
variable size Number of bytes to allocate for an lvarchar variable of specified size Integer value can be 1 - 32,768 (32 KB).
*variable name Name of an lvarchar pointer variable for data of unspecified length Not equivalent to a C char pointer (char *). Points to an internal ESQL/C representation for this type. You must use the ifx_var() functions to manipulate data.
The following figure shows declarations for three lvarchar variables that hold values for LVARCHAR columns.
Figure 1. Sample lvarchar host variables
EXEC SQL BEGIN DECLARE SECTION;
   lvarchar *a_polygon;
   lvarchar circle1[CIRCLESZ],          circle2[CIRCLESZ];
EXEC SQL END DECLARE SECTION;
Important: To declare a lvarchar host variable for the external format of an opaque data type, use the syntax described in Declare lvarchar host variables.

Copyright© 2019 HCL Technologies Limited