IBM Books

SQL Reference


Appendix C. SQL Descriptor Area (SQLDA)

An SQLDA is a collection of variables that is required for execution of the SQL DESCRIBE statement. The SQLDA variables are options that can be used by the PREPARE, OPEN, FETCH, EXECUTE, and CALL statements. An SQLDA communicates with dynamic SQL; it can be used in a DESCRIBE statement, modified with the addresses of host variables, and then reused in a FETCH statement.

SQLDAs are supported for all languages, but predefined declarations are provided only for C, REXX, FORTRAN, and COBOL. In REXX, the SQLDA is somewhat different than in the other languages; for information on the use of SQLDAs in REXX see the Application Development Guide

The meaning of the information in an SQLDA depends on its use. In PREPARE and DESCRIBE, an SQLDA provides information to an application program about a prepared statement. In OPEN, EXECUTE, FETCH, and CALL, an SQLDA describes host variables.

In DESCRIBE and PREPARE, if any one of the columns being described is either a LOB type, 97 reference type or a distinct type, the number of SQLVAR entries for the entire SQLDA will be doubled. For example:

When describing a table with 3 VARCHAR columns and 1 INTEGER column, there will be 4 SQLVAR entries
When describing a table with 2 VARCHAR columns, 1 CLOB column, and 1 integer column, there will be 8 SQLVAR entries

In EXECUTE, FETCH, OPEN, and CALL, if any one of the variables being described is a LOB type, 97 the number of SQLVAR entries for the entire SQLDA needs to be doubled. 98


Footnotes:

97
LOB locators and file reference variables do not require doubled SQLDAs.

98
Distinct types are not relevant in these cases since a host variable cannot be a distinct type.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]