Indicator Variables and Input - 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

Use indicator variables when the application requires the database to set a column value to null, such as when executing an INSERT or UPDATE statement.

Indicator variables can be used within a WHERE clause with host variables to indicate a null.

A negative value indicates the value in the associated main variable is to be ignored and PP2 is to send a null to the database for the column.

A zero or positive value specifies the host variable value is to be sent to the database as the column value.

EXEC SQL
      INSERT table1 VALUES (:hostvar1 :indvar1)
END-EXEC
EXEC SQL
      UPDATE   table1
      SET   col1 = :hostvar1 :indvar1
      WHERE col1 = :hostvar2
END-EXEC