Using PL/I Structures as Input Host Variables - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

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

Using PL/I Structures as Input Host Variables

The following rules apply to using PL/I structures as input host variables.

  • Use host structures to enter data into the Teradata Database. This is useful for an INSERT with a VALUES clause that inserts multiple fields into a table using host variables.
  • A host structure as an entity is valid for input only if all fields of the structure are validly defined to the precompiler. All of the fields of the structure are passed to the Teradata Database, therefore the application must ensure that the structure elements match the number of elements specified in the SQL statement.
  • Do not use a structure reference as an input entity in a WHERE clause or any place where a single field is expected.
  • Individual fields of a structure are valid for input if the fields are defined following precompiler rules.
  • PP2 supports structured host variables to a depth of two, following the same rules as SQL/DS and DB2.
  • Qualified references in embedded SQL statements are expressed using PL/I syntax; that is, with a dot separating the levels of qualification.
  • A typical host structure definition takes the following form:
  • DCL 01   STRUCTURE1,
             02 FIELD1   CHAR(20),
             02 FIELD2   FIXED BIN(31),
             02 FIELD3   CHAR(6),
             02 FIELD4   FIXED DEC(13,2);

    For other valid forms, see “Host Variable Declaration” on page 201.

    The structure level can go deeper than the two levels shown, but the items, if individually referenced, must be uniquely identifiable with a qualification depth of no more than two.