存储过程 Data truncation: Incorrect date value: ‘1988‘ for column ‘date‘ at row 1

tech2024-10-30  3

最近写存储过程报错

网上搜都是说mysql sql脚本格式不对

我这里是存储过程,我在想时间也是对的啊,时间格式,为啥

原来的

SET updateSQL = CONCAT("INSERT INTO data_bi.bi_user_catch_partake_day_static(date, room_id, vip, user_type, fish_id, factor_type, acc_num, first_acc_num) SELECT date, room_id, vip, user_type, fish_id, factor_type, count(account_id), count(if(is_new_acc = 1,account_id,null)) FROM data_bi.bi_user_catch_partake_day_active WHERE date = ", theTime, " GROUP BY ", groupBySbStr, " ON DUPLICATE KEY UPDATE acc_num = VALUES(acc_num),first_acc_num = VALUES(first_acc_num)"); call data_tslog.execute_sql(updateSQL);

大家有没有发现

其实少了引号,这里解析为2020-08-11,引号没有解析

SET updateSQL = CONCAT("INSERT INTO data_bi.bi_user_catch_partake_day_static(date, room_id, vip, user_type, fish_id, factor_type, acc_num, first_acc_num) SELECT date, room_id, vip, user_type, fish_id, factor_type, count(account_id), count(if(is_new_acc = 1,account_id,null)) FROM data_bi.bi_user_catch_partake_day_active WHERE date = '", theTime, "' GROUP BY ", groupBySbStr, " ON DUPLICATE KEY UPDATE acc_num = VALUES(acc_num),first_acc_num = VALUES(first_acc_num)"); call data_tslog.execute_sql(updateSQL);

希望能帮到你,我的博客:idearyou.cn

最新回复(0)