The SQL Descriptor Area (SQLDA) structure is a collection of variables that is required for execution of the SQL DESCRIBE statement. The SQLDA variables are options that can be used with 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 about 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.
For detailed information about the SQLDA structure, including a description of its fields, see the SQL Reference.
Language Syntax
C Structure
/* File: sqlda.h */ /* Structure: SQLDA */ /* ... */ SQL_STRUCTURE sqlda { _SQLOLDCHAR sqldaid[8]; long sqldabc; short sqln; short sqld; struct sqlvar sqlvar[1]; }; /* ... */ |
/* File: sqlda.h */ /* Structure: SQLVAR */ /* ... */ SQL_STRUCTURE sqlvar { short sqltype; short sqllen; _SQLOLDCHAR *SQL_POINTER sqldata; short *SQL_POINTER sqlind; struct sqlname sqlname; }; /* ... */ |
/* File: sqlda.h */ /* Structure: SQLNAME */ /* ... */ SQL_STRUCTURE sqlname { short length; _SQLOLDCHAR data[30]; }; /* ... */ |
/* File: sqlda.h */ /* Structure: SQLVAR2 */ /* ... */ SQL_STRUCTURE sqlvar2 { union sql8bytelen len; char *SQL_POINTER sqldatalen; struct sqldistinct_type sqldatatype_name; }; /* ... */ |
/* File: sqlda.h */ /* Structure: SQL8BYTELEN */ /* ... */ union sql8bytelen { long reserve1[2]; long sqllonglen; }; /* ... */ |
/* File: sqlda.h */ /* Structure: SQLDISTINCT-TYPE */ /* ... */ SQL_STRUCTURE sqldistinct_type { short length; char data[27]; char reserved1[3]; }; /* ... */ |
COBOL Structure
* File: sqlda.cbl 01 SQLDA SYNC. 05 SQLDAID PIC X(8) VALUE "SQLDA ". 05 SQLDABC PIC S9(9) COMP-5. 05 SQLN PIC S9(4) COMP-5. 05 SQLD PIC S9(4) COMP-5. 05 SQLVAR-ENTRIES OCCURS 0 TO 1489 TIMES 10 SQLVAR. 10 SQLVAR2 REDEFINES SQLVAR. * |