Teradata Parallel Transporter DDL 运算符 - 规则中缺少 { EXTENDED_LITERAL_ CHAR_STRING_LITERAL_ }:字符串文字错误
Teradata Parallel Transporter DDL Operator - missing { EXTENDED_LITERAL_ CHAR_STRING_LITERAL_ } in Rule: Character String Literal ERROR
我想做的是在我的数据库中检查我的 table 是否存在,如果存在则删除它。这是我的 .tpt :
DEFINE JOB DELETE_ET_TABLES
DESCRIPTION 'Delete ET tables'
(
DEFINE OPERATOR DDL_OPERATOR
DESCRIPTION 'Teradata Parallel Transporter DDL Operator'
TYPE DDL
ATTRIBUTES
(
varchar TdpId = @TERADATA_TDP,
varchar UserName = @User,
varchar UserPassword = @Pwd
);
APPLY
'SELECT (CASE WHEN TableName = ''Test_Del''
THEN (''DROP TABLE @Table;'')
ELSE NULL
END)
FROM dbc.TablesV WHERE databasename = @Db;' TO OPERATOR(DDL_OPERATOR);
这是我收到的错误消息:
Running "tbuild" command: tbuild -f /$HOME/loaders/test_deleteETTables.tpt -u TERADATA_TDP=$TDP, TERADATA_DATABASE=$DB -L /$LOG/
Teradata Parallel Transporter Version 16.20.00.09 64-Bit
TPT_INFRA: Syntax error at or near line 18 of Job Script File '/$HOME/loaders/test_deleteETTables.tpt':
TPT_INFRA: At "(" missing { EXTENDED_LITERAL_ CHAR_STRING_LITERAL_ } in Rule: Character String Literal
Compilation failed due to errors. Execution Plan was not generated.
你有什么想法吗?我尝试了多种方法,例如:
SELECT 1 FROM dbc.TablesV WHERE databasename = @Db AND TABLENAME ='TEST_DEL';
CASE WHEN ACTIVITYCOUNT = 1
THEN (DROP TABLE @Table)
ELSE ( QUIT )
END;
我的所有变量都已声明。我觉得在 que 语句中使用单引号是个问题,但我不确定,也不知道如何解决。非常感谢您的宝贵时间。
Fred 在评论中推荐我尝试的解决方案效果很好:
I think this is due to use of NULL but SELECT is not valid for DDL operator. The recommended way to do this is simply pass a DROP to the operator and tell it to ignore "not found" (and consider that success), i.e. ErrorList='3807'
DESCRIPTION 'Delete ET tables'
(
DEFINE OPERATOR DDL_OPERATOR
DESCRIPTION 'Teradata Parallel Transporter DDL Operator'
TYPE DDL
ATTRIBUTES
(
varchar TdpId = @TERADATA_TDP,
varchar UserName = @USERDB,
varchar UserPassword = @PWD,
VARCHAR ErrorList = '3807'
);
APPLY
('DROP TABLE @TABLENAME')
TO OPERATOR(DDL_OPERATOR);
);```
我想做的是在我的数据库中检查我的 table 是否存在,如果存在则删除它。这是我的 .tpt :
DEFINE JOB DELETE_ET_TABLES
DESCRIPTION 'Delete ET tables'
(
DEFINE OPERATOR DDL_OPERATOR
DESCRIPTION 'Teradata Parallel Transporter DDL Operator'
TYPE DDL
ATTRIBUTES
(
varchar TdpId = @TERADATA_TDP,
varchar UserName = @User,
varchar UserPassword = @Pwd
);
APPLY
'SELECT (CASE WHEN TableName = ''Test_Del''
THEN (''DROP TABLE @Table;'')
ELSE NULL
END)
FROM dbc.TablesV WHERE databasename = @Db;' TO OPERATOR(DDL_OPERATOR);
这是我收到的错误消息:
Running "tbuild" command: tbuild -f /$HOME/loaders/test_deleteETTables.tpt -u TERADATA_TDP=$TDP, TERADATA_DATABASE=$DB -L /$LOG/
Teradata Parallel Transporter Version 16.20.00.09 64-Bit
TPT_INFRA: Syntax error at or near line 18 of Job Script File '/$HOME/loaders/test_deleteETTables.tpt':
TPT_INFRA: At "(" missing { EXTENDED_LITERAL_ CHAR_STRING_LITERAL_ } in Rule: Character String Literal
Compilation failed due to errors. Execution Plan was not generated.
你有什么想法吗?我尝试了多种方法,例如:
SELECT 1 FROM dbc.TablesV WHERE databasename = @Db AND TABLENAME ='TEST_DEL';
CASE WHEN ACTIVITYCOUNT = 1
THEN (DROP TABLE @Table)
ELSE ( QUIT )
END;
我的所有变量都已声明。我觉得在 que 语句中使用单引号是个问题,但我不确定,也不知道如何解决。非常感谢您的宝贵时间。
Fred 在评论中推荐我尝试的解决方案效果很好:
I think this is due to use of NULL but SELECT is not valid for DDL operator. The recommended way to do this is simply pass a DROP to the operator and tell it to ignore "not found" (and consider that success), i.e. ErrorList='3807'
DESCRIPTION 'Delete ET tables'
(
DEFINE OPERATOR DDL_OPERATOR
DESCRIPTION 'Teradata Parallel Transporter DDL Operator'
TYPE DDL
ATTRIBUTES
(
varchar TdpId = @TERADATA_TDP,
varchar UserName = @USERDB,
varchar UserPassword = @PWD,
VARCHAR ErrorList = '3807'
);
APPLY
('DROP TABLE @TABLENAME')
TO OPERATOR(DDL_OPERATOR);
);```