17.05 - Example: USING Request Modifier with Variables - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

In this example the USING request modifier defines the variables :emp_name and :emp_number as, a CHARACTER constant and an INTEGER numeric constant, respectively. The USING variables are replaced by values from a client system data record when the system processes the accompanying INSERT request.

     .SET RECORDMODE ON
     .IMPORT DATA FILE = r13sales.dat;

     USING (emp_name   CHARACTER(40),
            emp_number INTEGER)
     INSERT INTO employee (name, empno)
     VALUES (:emp_name, :emp_number);

The INSERT request (in Record Mode on an IBM mainframe) is transmitted to the database with an appended 44-byte data record consisting of a 40-byte EBCDIC character string followed by a 32-bit integer.