上述错误的原因可以解释为:There is a schema mismatch between the schema defined in TPT script and the schema returned from the select request sent to DBS.
要避免此问题其实比较简单,你只需要设置与session字符集相匹配的字段长度即可:
如果你在TPT脚本中将session的字符集设置为UTF8,你需要:
— 将Unicode字段的长度设置为原来的3倍;
— 将LATIN字段的长度设置为原来的2倍.
如果你在TPT脚本中将session的字符集设置为UTF16,你需要 :
— 将所有Unicode及LATIN字段的长度均设为原字段长度的2倍。
以session字符集设为UTF16举例说明如下:
源表:
CREATE MULTISET TABLE TESTDB.SMS_E9_DAILY_NEW_OLD
(
data_date DATE FORMAT ‘YYYYMMDD’ TITLE ‘日期’,
area VARCHAR(10) CHARACTER SET UNICODE NOT CASESPECIFIC TITLE ‘区域名称’,
cdsc_type_lvl2 VARCHAR(8) CHARACTER SET UNICODE NOT CASESPECIFIC TITLE ‘套餐名称’,
CDSC_3G_type VARCHAR(8) CHARACTER SET UNICODE NOT CASESPECIFIC TITLE ‘3G套餐名称’,
Sum_New_Users INTEGER TITLE ‘新增用户数’,
Sum_Combi_Users INTEGER TITLE ‘新增融合用户’)
PRIMARY INDEX ( data_date ,area ,cdsc_type_lvl2 ,CDSC_3G_type );
可以看到,上述表有三个Unicode字段,其长度分别为10,8,8,因此TPT脚本需要定义为:
USING CHARACTER SET UTF16
DEFINE JOB APPMART_SMS_E9_DAILY_NEW_OLD
(
DEFINE SCHEMA TDSCHEMA
DESCRIPTION ‘SCHEMA DEFINITION’
(
data_date INTDATE,area
VARCHAR(20),
cdsc_type_lvl2
VARCHAR(16),
CDSC_3G_type
VARCHAR(16),
Sum_New_Users INTEGER,Sum_Combi_Users INTEGER
);
DEFINE OPERATOR EXPORT_OPERATOR
TYPE EXPORT
SCHEMA TDSCHEMA
ATTRIBUTES
(
VARCHAR PrivateLogName = ‘export_log’,
…
);
DEFINE OPERATOR UPDATE_OPERATOR
TYPE UPDATE
SCHEMA *
ATTRIBUTES
(
VARCHAR UserName=’SYSDBA’,
…
VARCHAR WorkingDatabase
);
APPLY (‘insert into TESTDB.SMS_E9_DAILY_NEW_OLD (data_date,area,cdsc_type_lvl2,CDSC_3G_type,Sum_New_Users,Sum_Combi_Users) values (:data_date,:area,:cdsc_type_lvl2,:CDSC_3G_type,:Sum_New_Users,:Sum_Combi_Users);’) TO OPERATOR (UPDATE_OPERATOR[1])
SELECT * FROM OPERATOR (EXPORT_OPERATOR[1]);
);
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16723161/viewspace-1057703/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16723161/viewspace-1057703/