IBM Support

当字段名称包含非字母数字字符、带音标字符或者形意文字(中文、日文、韩文)时INGEST命令失败

Troubleshooting


Problem

当字段名称包含非字母数字字符、带音标字符或者形意文字(中文、日文、韩文)时INGEST命令失败,错误代码QL40133N、SQL2032N、或SQL2971N

Symptom

当字段名称包含以下字符之外的字符时INGEST命令失败:
'A' - 'Z'
'a' - 'z'
'0' - '9'
'#', '@', '$', '_'

下面是一个包含中文字符字段的INGEST命令:
INGEST FROM FILE my_file.del FORMAT DELIMITED
(
$顾客姓名 CHAR(32),
$顾客编号 INTEGER EXTERNAL,
$顾客电话 CHAR(20)
)
INSERT INTO my_table;

这个命令会收到下面几个错误之一(根据版本和补丁包情况决定):
SQL40133N In the definition of field "$顾客姓名" at index "0", the "piName" field in struct "db2IngestFieldDefn" contains value "$顾客姓名", which is invalid or conflicts with another field value.

SQL2032N The "$顾客姓名 db2IngestFieldDefn[0].piName->pioData" parameter is not valid.

SQL2971N The ingest operation failed because invalid input was specified. Outer structure: "db2IngestFormat". Inner structure: "db2IngestFieldDefn". Index: "0". Field: "piName->pioData". Value: "$顾客姓名".
For information on resolving the problem, refer to section "Resolving the problem".

Cause

这个问题是由于INGEST命令只接受包含以下字符的字段名:
'A' - 'Z'
'a' - 'z'
'0' - '9'
'#', '@', '$', '_'

Resolving The Problem

为了解决这个问题,需要将每个字段的名加双引号(")。双引号必须在美元符号($)后开始,包含整个字段名在字段名最后一个字符后结束。

以下是之前出错INGEST命令的修改方法:

INGEST FROM FILE my_file.del FORMAT DELIMITED
(
$"顾客姓名" CHAR(32),
$"顾客编号" INTEGER EXTERNAL,
$"顾客电话" CHAR(20)
)
INSERT INTO my_table;

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"OTHER - Uncategorised","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"10.1;10.5","Edition":"Advanced Enterprise Server;Advanced Workgroup Server;Enterprise Server","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21971306