当我使用相同的查询pn SQL选项卡时,它完美地工作。但在程序中我得到同样的错误。无法识别的数据类型。 (靠近“,”,位置67,100,135,162,190)
DELIMITER //
CREATE PROCEDURE add_special_day
BEGIN
INSERT INTO slider (status, first_title_tr, second_title_tr, sub_title_tr, button_one_title_tr, button_one_link_tr, image, starting_date, ending_date, create_date)
SELECT status, first_title_tr, second_title_tr, sub_title_tr, button_one_title_tr, button_one_link_tr, image, starting_date, ending_date, create_date FROM special_days WHERE CURDATE() >= special_days.starting_date
END //
DELIMITER ;
答案 0 :(得分:2)
要使定义在语法上正确,请在过程名称的末尾添加括号(CREATE PROCEDURE add_special_day()),并在INSERT语句的末尾添加分号。
DELIMITER //
CREATE PROCEDURE add_special_day()
BEGIN
INSERT INTO slider (status, first_title_tr, second_title_tr, sub_title_tr, button_one_title_tr, button_one_link_tr, image, starting_date, ending_date, create_date)
SELECT status, first_title_tr, second_title_tr, sub_title_tr, button_one_title_tr, button_one_link_tr, image, starting_date, ending_date, create_date
FROM special_days WHERE CURDATE() >= special_days.starting_date;
END //
DELIMITER ;