首页 > 解决方案 > MariaDB服务器版本上参数错误的SQL存储过程LIKE操作

问题描述

我想使用 LIKE 操作创建存储过程,但出现错误并且我看到的答案* *对于当前版本来说已经过时了。我怎样才能正确编写程序

得到同样的错误:你的 SQL 语法有错误;查看与您的 MariaDB 服务器版本相对应的手册,了解在 'LIKE '%' + @Name + '%' AND 附近使用的正确语法;brandLIKE '%' + @Brand+ '%' AND; 第 2 行的“描述”

试过这些:

BEGIN
 `name` LIKE '%' + @Name + '%' AND
 `brand` LIKE '%' + @Brand+ '%' AND
 `description` LIKE '%' + @Desc + '%' AND
 `type` LIKE '%' + @Type + '%';
END


BEGIN
 `name` LIKE CONCAT('%', @Name, '%') AND
 `brand` LIKE CONCAT('%', @Brand, '%') AND
 `description` LIKE CONCAT('%', @Desc, '%') AND
 `type` LIKE CONCAT('%', @Type, '%');
END

文档:https ://dev.mysql.com/doc/refman/5.7/en/create-procedure.html

截屏: 屏幕 错误

标签: mysqlstored-procedures

解决方案


推荐阅读