An lvarchar pointer host variable with a descriptor
If you use an lvarchar pointer host variable with
a FETCH or PUT statement that uses a system descriptor area, you must
explicitly set the type to 124 (CLVCHARPTRTYPE from incl/esql/sqltypes.h)
in the SET DESCRIPTOR statement. The following example illustrates:
EXEC SQL BEGIN DECLARE SECTION;
lvarchar *lv;
EXEC SQL END DECLARE SECTION;
/* where tab has lvarchar * column */
EXEC SQL prepare stmt from “select col from tab”;
EXEC SQL allocate descriptor ‘d’;
/* The following describe will return SQLLVARCHAR for the
type of the column */
EXEC SQL describe stmt using sql descriptor ‘d’;
/* You must set type for *lv variable */
EXEC SQL set descriptor ‘d’ value 1 DATA = :lv, TYPE = 124;
EXEC SQL declare c cursor for stmt;
EXEC SQL open c;
EXEC SQL fetch c using sql descriptor ‘d’;