17.05 - Example: USING Request Modifier Reads Character Strings - 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 a variable parameter for use with an explicit transaction that reads character strings from a disk file and inserts them in signed zoned decimal format.

The USING request modifier precedes the BEGIN TRANSACTION statement, while the BEGIN TRANSACTION statement and the request associated with the USING clause are entered as one multistatement request.

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

     USING (zonedec CHARACTER(4))
     BEGIN TRANSACTION
    ;INSERT INTO dectest (colz = :zonedec (DECIMAL(4),
     FORMAT '9999S')) ;

     USING (zonedec CHARACTER(4))
     INSERT INTO Dectest
        (colz = :zonedec (DECIMAL(4), FORMAT '9999S')) ;

     USING (zonedec CHARACTER(4))
     INSERT INTO Dectest
        (colz = :zonedec (DECIMAL(4), FORMAT '9999S')) ;
     END TRANSACTION;

In BTEQ applications, you can combine USING request modifiers with the .REPEAT command to perform multiple insertions automatically.