Example – DML LABEL - MultiLoad

Teradata® MultiLoad Reference - 20.00

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
MultiLoad
Release Number
20.00
Published
October 2023
Language
English (United States)
Last Update
2024-03-18
dita:mapPath
lji1691576359330.ditamap
dita:ditavalPath
kju1619195148891.ditaval
dita:id
sga1478609868891
Product Category
Teradata Tools and Utilities

Each record in the following upsert example contains the value of the primary index column (EmpNo) of a row of the Employee table whose PhoneNo column is to be assigned a new phone number from field Fone.

The example assumes that the current default database is Personnel, the database containing Employee.

.BEGIN IMPORT MLOAD TABLES Employee
.LAYOUT Layoutname;
.FIELD EmpNum 1 INTEGER;
.FIELD Fone * (CHAR (10));
.DML LABEL DMLlabelname
DO INSERT FOR MISSING UPDATE ROWS;
UPDATE Employee SET PhoneNo = :Fone WHERE EmpNo = :EmpNum;
INSERT Employee (EmpNo, PhoneNo) VALUES (:EmpNum, :Fone); 

When the update operation fails, the INSERT statement executes, per the upsert feature. In this case, each record contains the primary key value (EmpNum) of a row that is to be inserted successively into the Employee table whose columns are EmpNo and PhoneNo.