I am trying to create a stored procedure that when given a month value, returns the user the last day of the month.
So far:
DROP PROCEDURE IF EXISTS getLastDayMonth$$
CREATE PROCEDURE getLastDayMonth(IN inMonth int)
BEGIN
SELECT LAST_DAY(inMonth);
END $$
I am having trouble figuring out how i can make inMonth a parameter that the sql function Last_DAY accepts. Is there another function that takes in an int as a month and returns the last day of the month? I am trying to avoid giving a DATE type as a paramater
You can add moths to first year day and get last_date:
Alternative solution is ELT function:
The last one, use
casestatement:EDITED