Dynamic SQL - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

Product
Preprocessor2 for Embedded SQL
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2446
lifecycle
previous
Product Category
Teradata Tools and Utilities

Dynamic SQL is supported in PL/I, and the application must code the necessary SQL Descriptor Area (SQLDA) structures. For details on the SQLDA and its fields, see SQL Stored Procedures and Embedded SQL (B035‑1148).

Define the necessary SQLDA structure in one of two ways:

  • Embed an EXEC SQL INCLUDE SQLDA statement into the application, which causes PP2 to generate the structure.
  • Code the SQLDA directly into the program. Use any name for the structure.
  • The generated SQLDA structure for a PL/I program is:

    DCL 1 SQLDA BASED(SQLDAPTR),
          2  SQLDAID  CHAR(8) INIT(’SQLDA   ’),
          2  SQLDABC   FIXED BIN(31),
          2  SQLN     FIXED BIN(15),
          2  SQLD     FIXED BIN(15),
          2  SQLVAR(SQLSIZE REFER(SQLN)),
             3 SQLTYPE   FIXED BIN(15),
             3 SQLLEN    FIXED BIN(15),
             3 SQLDATA   PTR,
             3 SQLIND    PTR,
             3 SQLNAME   CHAR(30) VAR;
    DCL SQLSIZE FIXED BIN(15);
    DCL SQLDAPTR PTR;