I'm using Laravel 6.2 and I have the following code in my controller
$date_ini='01-01-2022';
$date_fin='31-12-2022';
$seg=\DB::select('CALL pr_SegOrder(?,?,?)',[$client,$date_ini,$date_fin]);
return $seg;
And this is my stored procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `pr_SegOrder`(`client` varchar(200), `date_ini` datetime, `date_fin` datetime)
BEGIN
SELECT cod,norder
FROM
order op
WHERE
cast(op.created_at as date) BETWEEN @date_ini AND @date_fin
ORDER BY
op.cod asc ;
END
If I execute my query on MySql everything works fine. When I execute the SP from Laravel there is no error message, just an empty result.
The problem only ocurring when i use date parameters, because if only send "client" parameter from laravel, works fine.
any idea what could occurring?