我一直在尝试使用单个更新查询执行批量更新,但无法在存储过程中执行此操作。以下是完美运行的批量更新查询
UPDATE `batch_requests_detail`
SET `processing_status` = 5
WHERE `batch_requests_detail_id` IN (1,2,3);
当我在存储过程中使用它时它不起作用
CALL Update_Batch_Request_Detail_Bulk('1,2,3',10);
CREATE DEFINER=`root`@`%` PROCEDURE `Update_Batch_Request_Detail_Bulk`(
IN _batch_request_detail_ids VARCHAR(5000),
IN _processing_status INT
)
BEGIN
UPDATE `batch_requests_detail`
SET `processing_status` = _processing_status
WHERE `batch_requests_detail_id` IN (_batch_request_detail_ids);
END$$
DELIMITER ;
假设 _batch_request_detail_ids = "1,2,3",试试这个: