[英]execute immediate with string in sql statement in teradata
在Teradata中使用立即执行时,我遇到了问题。
SET str_sql = 'UPDATE TABLE
SET COLA = 0';
EXECUTE IMMEDIATE str_sql;
上面的代码工作正常。
SET str_sql = 'UPDATE TABLE
SET COLA = 0,
COLB = ''test''';
EXECUTE IMMEDIATE str_sql;
上面带字符串的代码返回错误。
以下是错误消息:
Executed as Single statement. Failed [3706 : 42000] Table:Syntax error: expected something between a string or a Unicode character literal and the word 'test'.
Elapsed time = 00:00:00.212
STATEMENT 1: CALL failed.
有谁知道如何在SQL中使用String调用立即执行? 谢谢!
刘Liu
问题可能出在报价上。 代替这个
SET str_sql = 'UPDATE TABLE
SET COLA = 0,
COLB = ''test''';
EXECUTE IMMEDIATE str_sql;
使用双引号。
SET str_sql = 'UPDATE TABLE
SET COLA = 0,
COLB = 'test'';
EXECUTE IMMEDIATE str_sql;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.