Field descriptions of an occurrence of an extended SQLVAR

The fields of an extended SQLVAR have different uses depending on the SQL statement.

The following table describes the contents of the fields of an extended SQLVAR entry.

Table 1. Fields in an occurrence of an extended SQLVAR
C name
assembler,
COBOL, or
PL/I name
Data
type
Usage in DESCRIBE1
and PREPARE INTO
Usage in FETCH, OPEN,
EXECUTE, and CALL
len.sqllonglen
SQLLONGL
SQLLONGLEN
INTEGER The length attribute of a LOB (BLOB, CLOB, or DBCLOB) column The length attribute of a LOB (BLOB, CLOB, or DBCLOB) host variable. Db2 ignores the SQLLEN field in the base SQLVAR for these data types. The length attribute indicates the number of bytes for a BLOB or CLOB, and the number of characters for a DBCLOB.
* INTEGER Reserved Reserved.
sqldatalen
SQLDATAL
SQLDATALEN
Pointer Not used Used only for LOB (BLOB, CLOB, and DBCLOB) host variables.

If the value of the field is null, the actual length of the LOB is stored in the 4 bytes immediately before the start of the data, and SQLDATA points to the first byte of the field length. The actual length indicates the number of bytes for a BLOB or CLOB, and the number of characters for a DBCLOB.

If the value of the field is not null, the field contains a pointer to a 4-byte long buffer that contains the actual length in bytes (even for DBCLOBs) of the data in the buffer pointed to from the SQLDATA field in the matching base SQLVAR.

Regardless of whether this field is used, field SQLLONGLEN must be set.

sqldatatype_name
SQLTNAME
SQLDATATYPE-
NAME
VARCHAR(30) A SQLTNAME field of the extended SQLVAR is set to one of the following:
  • For a distinct type column, the database manager sets this field to the fully qualified distinct type name. If the qualified name is longer than 30 bytes, it is truncated.
  • For a label, the database manager sets this field to label.

In the case that both a distinct type name and a label need to be returned in extended SQLVAR entries (USING BOTH has been specified), the distinct type name is returned in the first extended SQLVAR entry and the label in the second extended SQLVAR entry.

Not used.
Note:
  1. The third column of this table represents several forms of the DESCRIBE statement: