SQLDA Structure | VantageCloud Lake - SQLDA Structure - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

The following table describes the fields of SQLDA.

Field Name Format Description
SQLDAID CHARACTER(8) Contains the characters SQLDA.
SQLDABC INTEGER Length of the SQLDA calculated as (16 + (44 * SQLN value)) and set by the preprocessor when a DESCRIBE statement or PREPARE statement with an INTO clause is run.

For input, the application must set this field to the size of the SQLDA structure.

For output, the preprocessor sets the size necessary to contain the number of columns (SQLD) to be returned by the DESCRIBE or PREPARE INTO request.

SQLN SHORT INTEGER Total number of elements in the SQLVAR array.

The application sets this field to the number of elements available for use by the preprocessor (SQLVAR).

For input, SQLN must be set before an OPEN or EXECUTE statement.

For output, SQLN must be set before a DESCRIBE or PREPARE INTO request.

If the BOTH option of the USING clause is used, then you must specify at least twice the number of SQLVAR elements as columns to be returned.

SQLD SHORT INTEGER Number of elements in the SQLVAR array used to hold variable descriptions.

For input, the application sets this field to the number of SQLVAR elements used for input variable information.

Value must be set before an OPEN or EXECUTE statement.

For output, the preprocessor returns the number of SQLVAR elements that the DESCRIBE or PREPARE INTO request used.

If not enough elements are defined to satisfy the DESCRIBE, SQLD is set to the number required and no SQLVAR elements are returned.

If the BOTH option of the USING clause is used, then you must specify at least twice the number of SQLVAR elements as columns to be returned.

SQLVAR array Contains a repeating second level structure that describes the columns of the result data.
The structure of an SQLVAR element is as follows:
  • SQLTYPE (SHORT INTEGER)

    Contains a code indicating the data type of the column and its nullability attribute.

    See SQLDA Data Type Codes for a discussion of data type codes.

    For input, the application sets the input host variable type before an OPEN or EXECUTE statement.

    For output, the type is returned by performing a DESCRIBE statement.

    If the type of the host variable to receive the data differs from the value returned, the application must make sure the correct data type is placed in the field before running the FETCH.

  • SQLLEN (SHORT INTEGER)

    Data length for all data types except DECIMAL.

    For DECIMAL, SQLLEN is overdefined as SQLPRCSN and SQLSCALE.

  • SQLPRCSN (BYTE INTEGER - high order byte of SQLLEN)

    Decimal precision (total number of digits)

  • SQLSCALE (BYTE INTEGER -- low order byte of SQLLEN)

    Decimal scale (number of digits to the right of the decimal point)

For input, the application sets the input host variable length before an OPEN or EXECUTE statement.

For output, the preprocessor returns the data length of the column.

If the length of the host variable differs from the value returned, the application must make sure that the correct length is placed in the field before the FETCH.

SQLDATA pointer Indicates to the preprocessor either:
  • The address of the input host variable from which the value is to be taken.
  • The output host variable where the result value is to be stored.

The application must set this field before performing the OPEN, EXECUTE, or FETCH statements.

See Teradata® Preprocessor2 for Embedded SQL Programmer Guide, B035-2446 for examples of how to set addresses in COBOL.

SQLIND pointer Indicates to the preprocessor the address of the indicator variable associated with the input/output host variable pointed to by SQLDATA.

The application sets this field to the address of the associated indicator variable (if any) to be used with the field whose address is in SQLDATA.

This field must be set to x'00' if you do not use an indicator variable.

The application must set this field before performing the OPEN, EXECUTE, or FETCH statements.

SQLNAME VARCHAR (30) Contains either of the following:
  • The column name.
  • The column title.

For input this field has no meaning as an input host variable.

For output, the preprocessor sets this field based on information in the USING clause.

This field is used only by the application and has no further meaning to the preprocessor.