SQLDA Structure | Teradata Vantage - SQLDA Structure - Advanced SQL Engine - Teradata Database

SQL Stored Procedures and Embedded SQL

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
xqq1557098602407.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1148
lifecycle
previous
Product Category
Teradata Vantage™

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 executed.

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 prior to an OPEN or EXECUTE statement.

For output, SQLN must be set prior to 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 currently 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 prior to an OPEN or EXECUTE statement.

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

If too few 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 prior to 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 ensure the correct data type is placed in the field prior to executing 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 prior to 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 ensure that the correct length is placed in the field prior to 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 prior to 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 should be set to x'00' if you do not use an indicator variable.

The application must set this field prior to 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.