Teradata创建表自动增量列错误

时间:2016-04-12 23:48:58

标签: mysql database csv teradata

我正在尝试使用Teradata的Fastload脚本将我的CSV文件导入Teradata。 我还尝试添加自动增量列。 这是我的CSV文件:

Word,country,sale,week
hi,USA,26.17,11/22/15-11/28/15
bye,USA,16.5,11/22/15-11/28/15

代码段

String tableName = "my_db.mytable";
    String createTable = "CREATE TABLE " + tableName + "," +
                            "NO FALLBACK," +
                            "NO BEFORE JOURNAL," +
                            "NO AFTER JOURNAL," +
                            "CHECKSUM = DEFAULT" +
                            "(" +
                            " id decimal(10,0) NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 NO CYCLE),"+
                            " word VARCHAR(500) CHARACTER SET UNICODE," +
                            " country VARCHAR(50)," +
                            " sale FLOAT," +
                            " week VARCHAR(30)" +
                            ") " +
                          "PRIMARY INDEX (id)";

    // INSERT statement
    String insertTable = "INSERT INTO " + tableName + " VALUES(?,?,?,?,?)";

我得到的错误:

Row 1 in FastLoad table my_db.mytable_ERR_1 contains the following data: 
ErrorCode=2673
ErrorFieldName=F_id
ActualDataParcelLength=55
DataParcel: byte array length 55 (0x37), offset 0 (0x0), dump length 55 (0x37)

1 个答案:

答案 0 :(得分:0)

这看起来不像是FastLoad脚本,是JDBC-FastLoad的一部分吗?

  

2673源宗地长度与定义的数据不匹配。

您的输入数据是逗号分隔的文本,因此您必须将所有列定义为VARCHAR。

输入文件中有四个列,但您在INSERT中指定了五个。顾名思义,自动创建GENERATED ALWAYS序列。