Dynamic SQL - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Teradata Preprocessor2
Release Number
20.00
Published
October 2023
ft:locale
en-US
ft:lastEdition
2023-11-20
dita:mapPath
nyr1691484085721.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
xfi1470440464166
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;