我正在使用准备好的语句来执行更新查询,但收到以下错误。
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;
最佳答案
我明白了。我陷入了循环并且 id 为空
关于mysql - 错误代码: 1064 in stored procedure update,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45241928/