USING Examples | SQL Statements | Teradata Vantage - 17.05 - Example: USING Request Modifier - 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 establishes three variable parameters whose constant values are used both for data input and as WHERE clause predicates in a multistatement request:

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

     USING (var_1 CHARACTER, var_2 CHARACTER, var_3 CHARACTER)
     INSERT INTO testtabu (c1) VALUES (:var_1)
    ;INSERT INTO testtabu (c1) VALUES (:var_2)
    ;INSERT INTO testtabu (c1) VALUES (:var_3)
    ;UPDATE testtabu
       SET c2 = c1 + 1
       WHERE c1 = :var_1
    ;UPDATE testtabu
       SET c2 = c1 + 1
       WHERE c1 = :var_2
    ;UPDATE testtabu
       SET c2 = c1 + 1
       WHERE c1 = :var_3;