So the parameters in the stored procedure are optional, meaning they can be null. The issue with my cade is that there is no output whenever I call the SP. I need my params to be able to accept null as well
CREATE PROCEDURE `GET`(
in startDate DATETIME,
in endDate DATETIME
)
BEGIN
SELECT * FROM DB.table
WHERE
DB.table.colunm >= startDate
AND
DB.table.colunm <= endDate;
END
when I call the stored procedure, I never get any result
call GET(2022-05-28, 2022-05-30)
call GET(null, null)
.. WHERE DB.table.column BETWEEN COALESCE(startDate, '1000-01-01 00:00:00') AND COALESCE(endDate, 9999-12-31 23:59:59);. PS. BEGIN-END may be removed, they're excess, and in this case you do not need to use DELIMITER additionally.