T-PUMP DML错误

时间:2016-03-26 15:24:36

标签: teradata

在运行T-PUMP时我遇到了DML错误。这是我的脚本,它将数据从文件加载到表infa_source12

.LOGTABLE  etlt5.EMP_TPUMP_LOG;
.logon ttdbia/USR/PASSWRD;
.BEGIN LOAD;
PACK 5
RATE 10
ERROR TABLE Etlt5.TPUMPERROR;
.LAYOUT RECLAYOUT;
.FIELD    id        * varchar(10);
.FIELD    name      * varchar(20);
.FIELD    country   * varCHAR(30);

.DML label INST;

INSERT INTO etlt5.infa_source12
(id,name,country)
VALUES 
(:id, :name, :country) 
.IMPORT INFINE /home/a0c9sx/SQLAExport.txt;
LAYOUT RECLAYOUT
APPLY INST ;
.END LOAD;
.LOGOFF;
ERROR:
**** 10:18:50 UTY2832 A .DML statement must be entered before any SQL

我参考了以下链接:

http://www.teradatawiki.net/2013/10/Teradatautilities-tpump.html

2 个答案:

答案 0 :(得分:1)

您的脚本充满了synax错误(从该网站复制):

.LOGTABLE  etlt5.EMP_TPUMP_LOG;
.logon ttdbia/USR/PASSWRD;
.BEGIN LOAD; -- no semicolon, the next keywords are part of BEGIN LOAD
        -- SESSIONS is missing
 PACK 5
 RATE 10
 ERROR TABLE Etlt5.TPUMPERROR; -- no space between ERROR and TABLE
.LAYOUT RECLAYOUT;
.FIELD    id        * varchar(10);
.FIELD    name      * varchar(20);
.FIELD    country   * varCHAR(30);

.DML label INST; 

INSERT INTO etlt5.infa_source12
(id,name,country)
VALUES 
(:id, :name, :country)  -- missing semicolon, needed for each SQL statement
.IMPORT INFINE /home/a0c9sx/SQLAExport.txt; -- no semicolon, the next keywords are part of IMPORT
LAYOUT RECLAYOUT
APPLY INST ;
.END LOAD;
.LOGOFF;

当您按照手册中的示例...

时,将节省更多时间

答案 1 :(得分:0)

您似乎缺少.DML命令的部分命令语法。不清楚的是,您是否需要使用SERIALIZEON

.LOGTABLE  etlt5.EMP_TPUMP_LOG;
.logon ttdbia/USR/PASSWRD;
.BEGIN LOAD;
PACK 5
RATE 10
ERROR TABLE Etlt5.TPUMPERROR;
.LAYOUT RECLAYOUT;
.FIELD    id        * varchar(10);
.FIELD    name      * varchar(20);
.FIELD    country   * varCHAR(30);

.DML LABEL INST
  DO INSERT FOR;

INSERT INTO etlt5.infa_source12
(id,name,country)
VALUES 
(:id, :name, :country) 
.IMPORT INFINE /home/a0c9sx/SQLAExport.txt;
LAYOUT RECLAYOUT
APPLY INST ;
.END LOAD;
.LOGOFF;

Teradata手册here中有关于T-Pump命令语法的更多信息。