I am getting an error in MariaDB when trying to create a function. It gives me the following error and I leave the script below.
The script:
CREATE PROCEDURE `total_hh`(fechainicio datetime, fechafin datetime) RETURNS int(11)
BEGIN
RETURN (select count(*) from datos d where d.fecha between date_format(fechainicio, "%Y,%m,%d %H,%i") and date_format(fechafin,"%Y,%m,%d %H,%i")
);
END
ACTUALIZATION: Now im getting this error when i try to create the function. Else when i try to run the script like a query i have another error SQL (1558).