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
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
vnq1596660420420.ditamap
dita:ditavalPath
hoy1596145193032.ditaval

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;