错误代码:存储过程更新中的1064

时间:2017-07-21 15:53:02

标签: mysql stored-procedures

我正在使用预准备语句来执行更新查询,但是我收到以下错误。

Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 

这是我准备好的声明产生的查询。

Declare update_table_stmt varchar(1024);
set @update_data = concat('update results_temp_tbl as t1 inner join data_temp_tbl as t2 on t2.suite_raw = t1.suite_raw set t1.`',@get_dataday,'` = ',@get_set_columns,';');
update results_temp_tbl as t1 inner join data_temp_tbl as t2 on t2.suite_raw = t1.suite_raw set     t1.`17356` = concat(t2.path,'/',t2.filename);

PREPARE update_table_stmt FROM @update_data;
EXECUTE update_table_stmt;
DEALLOCATE PREPARE update_table_stmt;

如果我复制上面的查询并运行它,我没有错误。所以我不确定如何解决问题

***** ****更新

仍然收到错误。我已经调整了代码,所以它现在打印出以下内容。

update results_temp_tbl as t1 inner join data_temp_tbl as t2 on t2.suite_raw = t1.suite_raw set t1.`17356` = t2.filepath_name;

1 个答案:

答案 0 :(得分:0)

我明白了。我在一个循环中,id为null