我正在尝试检查存储过程输入是否为
CREATE DEFINER=`user`@`%` PROCEDURE `driver_journey_ids`(
IN p_driverID VARCHAR(255), # driver ids
IN p_vehicleID VARCHAR(255), # vehicle ids
)
SELECT
pl.eventID
FROM payload AS pl
WHERE
CASE
WHEN p_driverID IS NOT NULL THEN pl._driverID IN (p_driverID)
ELSE TRUE
END
AND CASE
WHEN p_vehicleID IS NOT NULL THEN pl._vehicleID IN (p_vehicleID)
ELSE TRUE
END
CALL driver_journey_ids(" 123,124,125",null)
SP是这样的,但WHEN导致了一个问题。 有没有办法检查数组是否有值? 如果在调用中传递单个值,则它可以工作,但如果在同一参数中传递多个值,则无效。
干杯, 菲尔