我试图在 MySQL 存储过程中将数组作为字符串传递,但它不能正常工作。
这是我的 SQL 代码:
CREATE DEFINER=`root`@`localhost` PROCEDURE `search_equipment`(IN equip VARCHAR(100), IN category VARCHAR(255))
BEGIN
SELECT *
FROM Equipment
WHERE e_description
LIKE CONCAT("%",equip,"%")
AND e_type IN (category)
END
这就是我如何调用该程序:
String type = "'I.T. Equipment','Office Supply'";
CALL search_equipment('some equipment', type);
有任何想法吗?